mirror of https://github.com/GNOME/gimp.git
use XGrabKey() to grab the Escape key instead of doing a full keyboard
2005-05-31 Sven Neumann <sven@gimp.org> * plug-ins/common/screenshot.c (select_window_x11): use XGrabKey() to grab the Escape key instead of doing a full keyboard grab.
This commit is contained in:
parent
07d6c60432
commit
315061ca00
|
@ -1,3 +1,8 @@
|
|||
2005-05-31 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/screenshot.c (select_window_x11): use XGrabKey()
|
||||
to grab the Escape key instead of doing a full keyboard grab.
|
||||
|
||||
2005-05-31 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpaction.c (gimp_action_set_proxy): added missing
|
||||
|
|
|
@ -368,11 +368,13 @@ select_window_x11 (GdkScreen *screen)
|
|||
Window x_root;
|
||||
XGCValues gc_values;
|
||||
GC gc = NULL;
|
||||
GdkKeymapKey *keys = NULL;
|
||||
gint x_scr;
|
||||
gint status;
|
||||
gint buttons;
|
||||
gint mask = ButtonPressMask | ButtonReleaseMask;
|
||||
gint x, y, w, h;
|
||||
gint num_keys;
|
||||
gboolean cancel = FALSE;
|
||||
|
||||
x_dpy = GDK_SCREEN_XDISPLAY (screen);
|
||||
|
@ -421,8 +423,11 @@ select_window_x11 (GdkScreen *screen)
|
|||
return 0;
|
||||
}
|
||||
|
||||
XGrabKeyboard (x_dpy, x_root, False,
|
||||
GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||
if (gdk_keymap_get_entries_for_keyval (NULL, GDK_Escape, &keys, &num_keys))
|
||||
{
|
||||
XGrabKey (x_dpy, keys[0].keycode, AnyModifier, x_root, False,
|
||||
GrabModeAsync, GrabModeAsync);
|
||||
}
|
||||
|
||||
while (! cancel && ((x_win == None) || (buttons != 0)))
|
||||
{
|
||||
|
@ -457,8 +462,10 @@ select_window_x11 (GdkScreen *screen)
|
|||
y = MIN (shootvals.y1, shootvals.y2);
|
||||
w = ABS (shootvals.x2 - shootvals.x1);
|
||||
h = ABS (shootvals.y2 - shootvals.y1);
|
||||
|
||||
if (w > 0 && h > 0)
|
||||
XDrawRectangle (x_dpy, x_root, gc, x, y, w, h);
|
||||
|
||||
shootvals.x2 = x_event.xbutton.x_root;
|
||||
shootvals.y2 = x_event.xbutton.y_root;
|
||||
}
|
||||
|
@ -471,6 +478,7 @@ select_window_x11 (GdkScreen *screen)
|
|||
y = MIN (shootvals.y1, shootvals.y2);
|
||||
w = ABS (shootvals.x2 - shootvals.x1);
|
||||
h = ABS (shootvals.y2 - shootvals.y1);
|
||||
|
||||
if (w > 0 && h > 0)
|
||||
XDrawRectangle (x_dpy, x_root, gc, x, y, w, h);
|
||||
|
||||
|
@ -481,6 +489,7 @@ select_window_x11 (GdkScreen *screen)
|
|||
y = MIN (shootvals.y1, shootvals.y2);
|
||||
w = ABS (shootvals.x2 - shootvals.x1);
|
||||
h = ABS (shootvals.y2 - shootvals.y1);
|
||||
|
||||
if (w > 0 && h > 0)
|
||||
XDrawRectangle (x_dpy, x_root, gc, x, y, w, h);
|
||||
}
|
||||
|
@ -510,7 +519,9 @@ select_window_x11 (GdkScreen *screen)
|
|||
}
|
||||
}
|
||||
|
||||
XUngrabKeyboard (x_dpy, CurrentTime);
|
||||
if (keys)
|
||||
XUngrabKey (x_dpy, keys[0].keycode, AnyModifier, x_root);
|
||||
|
||||
XUngrabPointer (x_dpy, CurrentTime);
|
||||
XFreeCursor (x_dpy, x_cursor);
|
||||
|
||||
|
|
Loading…
Reference in New Issue