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 @@ ...@@ -10,7 +10,8 @@
* plug-ins/imagemap/imap_preview.c * plug-ins/imagemap/imap_preview.c
* plug-ins/imagemap/imap_selection.c * plug-ins/imagemap/imap_selection.c
* plug-ins/jpeg/jpeg-exif.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> 2005-07-30 Sven Neumann <sven@gimp.org>
......
...@@ -144,6 +144,7 @@ static const guint8 screenshot_icon[] = ...@@ -144,6 +144,7 @@ static const guint8 screenshot_icon[] =
typedef enum typedef enum
{ {
SHOOT_ROOT, SHOOT_ROOT,
SHOOT_REGION,
SHOOT_WINDOW SHOOT_WINDOW
} ShootType; } ShootType;
...@@ -151,7 +152,6 @@ typedef struct ...@@ -151,7 +152,6 @@ typedef struct
{ {
ShootType shoot_type; ShootType shoot_type;
gboolean decorate; gboolean decorate;
gboolean region;
guint window_id; guint window_id;
guint select_delay; guint select_delay;
gint x1; gint x1;
...@@ -287,29 +287,31 @@ run (const gchar *name, ...@@ -287,29 +287,31 @@ run (const gchar *name,
break; break;
case GIMP_RUN_NONINTERACTIVE: 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; shootvals.shoot_type = SHOOT_ROOT;
else else
shootvals.shoot_type = SHOOT_WINDOW; shootvals.shoot_type = SHOOT_WINDOW;
shootvals.window_id = param[2].data.d_int32; shootvals.window_id = param[2].data.d_int32;
shootvals.select_delay = 0; shootvals.select_delay = 0;
} }
else 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; status = GIMP_PDB_CALLING_ERROR;
} }
if (nparams == 7)
{
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;
}
if (! gdk_init_check (NULL, NULL)) if (! gdk_init_check (NULL, NULL))
status = GIMP_PDB_CALLING_ERROR; status = GIMP_PDB_CALLING_ERROR;
break; break;
...@@ -384,7 +386,7 @@ select_window_x11 (GdkScreen *screen) ...@@ -384,7 +386,7 @@ select_window_x11 (GdkScreen *screen)
x_cursor = XCreateFontCursor (x_dpy, GDK_CROSSHAIR); x_cursor = XCreateFontCursor (x_dpy, GDK_CROSSHAIR);
buttons = 0; buttons = 0;
if (shootvals.region) if (shootvals.shoot_type == SHOOT_REGION)
{ {
mask |= PointerMotionMask; mask |= PointerMotionMask;
...@@ -460,8 +462,7 @@ select_window_x11 (GdkScreen *screen) ...@@ -460,8 +462,7 @@ select_window_x11 (GdkScreen *screen)
case ButtonRelease: case ButtonRelease:
if (buttons > 0) if (buttons > 0)
buttons--; buttons--;
if (! buttons && shootvals.shoot_type == SHOOT_REGION)
if (! buttons && shootvals.region)
{ {
x = MIN (shootvals.x1, shootvals.x2); x = MIN (shootvals.x1, shootvals.x2);
y = MIN (shootvals.y1, shootvals.y2); y = MIN (shootvals.y1, shootvals.y2);
...@@ -595,7 +596,7 @@ create_image (const GdkPixbuf *pixbuf) ...@@ -595,7 +596,7 @@ create_image (const GdkPixbuf *pixbuf)
gint rowstride; gint rowstride;
gint bpp; gint bpp;
gboolean status; gboolean status;
gchar *pixels; guchar *pixels;
gpointer pr; gpointer pr;
status = gimp_progress_init (_("Loading Screenshot...")); status = gimp_progress_init (_("Loading Screenshot..."));
...@@ -689,37 +690,40 @@ shoot (GdkScreen *screen) ...@@ -689,37 +690,40 @@ shoot (GdkScreen *screen)
screen_rect.width = gdk_screen_get_width (screen); screen_rect.width = gdk_screen_get_width (screen);
screen_rect.height = gdk_screen_get_height (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.x = MIN (shootvals.x1, shootvals.x2);
rect.y = MIN (shootvals.y1, shootvals.y2); rect.y = MIN (shootvals.y1, shootvals.y2);
rect.width = ABS (shootvals.x2 - shootvals.x1); rect.width = ABS (shootvals.x2 - shootvals.x1);
rect.height = ABS (shootvals.y2 - shootvals.y1); rect.height = ABS (shootvals.y2 - shootvals.y1);
}
} }
else else
{ {
GdkDisplay *display = gdk_screen_get_display (screen); if (shootvals.shoot_type == SHOOT_ROOT)
{
window = gdk_screen_get_root_window (screen);
}
else
{
GdkDisplay *display = gdk_screen_get_display (screen);
window = gdk_window_foreign_new_for_display (display, window = gdk_window_foreign_new_for_display (display,
shootvals.window_id); shootvals.window_id);
} }
if (! window) if (! window)
{ {
g_message (_("Specified window not found")); g_message (_("Specified window not found"));
return -1; return -1;
} }
gdk_drawable_get_size (GDK_DRAWABLE (window), &rect.width, &rect.height); gdk_drawable_get_size (GDK_DRAWABLE (window), &rect.width, &rect.height);
gdk_window_get_origin (window, &x, &y); gdk_window_get_origin (window, &x, &y);
rect.x = x; rect.x = x;
rect.y = y; rect.y = y;
}
window = gdk_screen_get_root_window (screen); window = gdk_screen_get_root_window (screen);
gdk_window_get_origin (window, &x, &y); gdk_window_get_origin (window, &x, &y);
...@@ -763,8 +767,15 @@ shoot_dialog (GdkScreen **screen) ...@@ -763,8 +767,15 @@ shoot_dialog (GdkScreen **screen)
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
GSList *radio_group = NULL; GSList *radio_group = NULL;
GtkObject *adj; GtkObject *adj;
gboolean region = FALSE;
gboolean run; gboolean run;
if (shootvals.shoot_type == SHOOT_REGION)
{
shootvals.shoot_type = SHOOT_ROOT;
region = TRUE;
}
gimp_ui_init ("screenshot", FALSE); gimp_ui_init ("screenshot", FALSE);
dialog = gimp_dialog_new (_("Screenshot"), "screenshot", dialog = gimp_dialog_new (_("Screenshot"), "screenshot",
...@@ -856,7 +867,7 @@ shoot_dialog (GdkScreen **screen) ...@@ -856,7 +867,7 @@ shoot_dialog (GdkScreen **screen)
gtk_widget_show (hbox); gtk_widget_show (hbox);
toggle = gtk_check_button_new_with_label (_("Select a region")); 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_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 24);
gtk_widget_show (toggle); gtk_widget_show (toggle);
...@@ -868,7 +879,7 @@ shoot_dialog (GdkScreen **screen) ...@@ -868,7 +879,7 @@ shoot_dialog (GdkScreen **screen)
g_signal_connect (toggle, "toggled", g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update), G_CALLBACK (gimp_toggle_button_update),
&shootvals.region); &region);
/* grab delay */ /* grab delay */
hbox = gtk_hbox_new (FALSE, 6); hbox = gtk_hbox_new (FALSE, 6);
...@@ -902,6 +913,9 @@ shoot_dialog (GdkScreen **screen) ...@@ -902,6 +913,9 @@ shoot_dialog (GdkScreen **screen)
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK); run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
if (shootvals.shoot_type == SHOOT_ROOT && region)
shootvals.shoot_type = SHOOT_REGION;
if (run) if (run)
{ {
/* get the screen on which we are running */ /* get the screen on which we are running */
...@@ -918,7 +932,7 @@ shoot_dialog (GdkScreen **screen) ...@@ -918,7 +932,7 @@ shoot_dialog (GdkScreen **screen)
g_timeout_add (100, (GSourceFunc) gtk_main_quit, NULL); g_timeout_add (100, (GSourceFunc) gtk_main_quit, NULL);
gtk_main (); 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); 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