Commit c0484b46 authored by Sven Neumann's avatar Sven Neumann
Browse files

Reverted inadvertent commit of changes to screenshot.c and only fixed the

signedness issue instead.
parent 26eecddb
......@@ -10,7 +10,8 @@
* plug-ins/imagemap/imap_preview.c
* plug-ins/imagemap/imap_selection.c
* plug-ins/jpeg/jpeg-exif.c
* plug-ins/common/dicom.c: fixed signedness warnings.
* plug-ins/common/dicom.c
* plug/ins/common/screenshot.c: fixed signedness warnings.
2005-07-30 Sven Neumann <sven@gimp.org>
......
......@@ -144,6 +144,7 @@ static const guint8 screenshot_icon[] =
typedef enum
{
SHOOT_ROOT,
SHOOT_REGION,
SHOOT_WINDOW
} ShootType;
......@@ -151,7 +152,6 @@ typedef struct
{
ShootType shoot_type;
gboolean decorate;
gboolean region;
guint window_id;
guint select_delay;
gint x1;
......@@ -287,29 +287,31 @@ run (const gchar *name,
break;
case GIMP_RUN_NONINTERACTIVE:
if (nparams >= 3)
if (nparams == 3)
{
if (param[1].data.d_int32)
gboolean do_root = param[1].data.d_int32;
if (do_root)
shootvals.shoot_type = SHOOT_ROOT;
else
shootvals.shoot_type = SHOOT_WINDOW;
shootvals.window_id = param[2].data.d_int32;
shootvals.select_delay = 0;
}
else
{
status = GIMP_PDB_CALLING_ERROR;
}
if (nparams == 7)
else if (nparams == 7)
{
shootvals.shoot_type = SHOOT_REGION;
shootvals.window_id = param[2].data.d_int32;
shootvals.select_delay = 0;
shootvals.x1 = param[3].data.d_int32;
shootvals.y1 = param[4].data.d_int32;
shootvals.x2 = param[5].data.d_int32;
shootvals.y2 = param[6].data.d_int32;
}
{
status = GIMP_PDB_CALLING_ERROR;
}
if (! gdk_init_check (NULL, NULL))
status = GIMP_PDB_CALLING_ERROR;
break;
......@@ -384,7 +386,7 @@ select_window_x11 (GdkScreen *screen)
x_cursor = XCreateFontCursor (x_dpy, GDK_CROSSHAIR);
buttons = 0;
if (shootvals.region)
if (shootvals.shoot_type == SHOOT_REGION)
{
mask |= PointerMotionMask;
......@@ -460,8 +462,7 @@ select_window_x11 (GdkScreen *screen)
case ButtonRelease:
if (buttons > 0)
buttons--;
if (! buttons && shootvals.region)
if (! buttons && shootvals.shoot_type == SHOOT_REGION)
{
x = MIN (shootvals.x1, shootvals.x2);
y = MIN (shootvals.y1, shootvals.y2);
......@@ -595,7 +596,7 @@ create_image (const GdkPixbuf *pixbuf)
gint rowstride;
gint bpp;
gboolean status;
gchar *pixels;
guchar *pixels;
gpointer pr;
status = gimp_progress_init (_("Loading Screenshot..."));
......@@ -689,17 +690,19 @@ shoot (GdkScreen *screen)
screen_rect.width = gdk_screen_get_width (screen);
screen_rect.height = gdk_screen_get_height (screen);
if (shootvals.shoot_type == SHOOT_ROOT)
{
window = gdk_screen_get_root_window (screen);
if (shootvals.region)
if (shootvals.shoot_type == SHOOT_REGION)
{
rect.x = MIN (shootvals.x1, shootvals.x2);
rect.y = MIN (shootvals.y1, shootvals.y2);
rect.width = ABS (shootvals.x2 - shootvals.x1);
rect.height = ABS (shootvals.y2 - shootvals.y1);
}
else
{
if (shootvals.shoot_type == SHOOT_ROOT)
{
window = gdk_screen_get_root_window (screen);
}
else
{
......@@ -720,6 +723,7 @@ shoot (GdkScreen *screen)
rect.x = x;
rect.y = y;
}
window = gdk_screen_get_root_window (screen);
gdk_window_get_origin (window, &x, &y);
......@@ -763,8 +767,15 @@ shoot_dialog (GdkScreen **screen)
GdkPixbuf *pixbuf;
GSList *radio_group = NULL;
GtkObject *adj;
gboolean region = FALSE;
gboolean run;
if (shootvals.shoot_type == SHOOT_REGION)
{
shootvals.shoot_type = SHOOT_ROOT;
region = TRUE;
}
gimp_ui_init ("screenshot", FALSE);
dialog = gimp_dialog_new (_("Screenshot"), "screenshot",
......@@ -856,7 +867,7 @@ shoot_dialog (GdkScreen **screen)
gtk_widget_show (hbox);
toggle = gtk_check_button_new_with_label (_("Select a region"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), shootvals.region);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), region);
gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 24);
gtk_widget_show (toggle);
......@@ -868,7 +879,7 @@ shoot_dialog (GdkScreen **screen)
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&shootvals.region);
&region);
/* grab delay */
hbox = gtk_hbox_new (FALSE, 6);
......@@ -902,6 +913,9 @@ shoot_dialog (GdkScreen **screen)
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
if (shootvals.shoot_type == SHOOT_ROOT && region)
shootvals.shoot_type = SHOOT_REGION;
if (run)
{
/* get the screen on which we are running */
......@@ -918,7 +932,7 @@ shoot_dialog (GdkScreen **screen)
g_timeout_add (100, (GSourceFunc) gtk_main_quit, NULL);
gtk_main ();
if (shootvals.shoot_type == SHOOT_WINDOW && ! shootvals.window_id)
if (shootvals.shoot_type != SHOOT_ROOT && ! shootvals.window_id)
{
shootvals.window_id = select_window (*screen);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment