Port key handling code to GTK3
GTK3 removed some previously-deprecated API that we still use. This includes GDK_DISPLAY(), gdk_x11_drawable_get_xdisplay(), and some key constants. Port our code to the new API. [split patch into several parts, added minimal description] Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
This commit is contained in:
parent
e2c07af748
commit
2bfb38ef82
@ -352,9 +352,11 @@ egg_accelerator_parse_virtual (const gchar *accelerator,
|
||||
bad_keyval = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (keycode != NULL)
|
||||
*keycode = XKeysymToKeycode (GDK_DISPLAY(), keyval);
|
||||
|
||||
} else if (keycode != NULL) {
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
*keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY(display),
|
||||
keyval);
|
||||
}
|
||||
accelerator += len;
|
||||
len -= len;
|
||||
}
|
||||
@ -624,20 +626,20 @@ reload_modmap (GdkKeymap *keymap,
|
||||
j = 0;
|
||||
while (j < n_entries)
|
||||
{
|
||||
if (keyvals[j] == GDK_Num_Lock)
|
||||
if (keyvals[j] == GDK_KEY_Num_Lock)
|
||||
mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
|
||||
else if (keyvals[j] == GDK_Scroll_Lock)
|
||||
else if (keyvals[j] == GDK_KEY_Scroll_Lock)
|
||||
mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
|
||||
else if (keyvals[j] == GDK_Meta_L ||
|
||||
keyvals[j] == GDK_Meta_R)
|
||||
else if (keyvals[j] == GDK_KEY_Meta_L ||
|
||||
keyvals[j] == GDK_KEY_Meta_R)
|
||||
mask |= EGG_VIRTUAL_META_MASK;
|
||||
else if (keyvals[j] == GDK_Hyper_L ||
|
||||
keyvals[j] == GDK_Hyper_R)
|
||||
else if (keyvals[j] == GDK_KEY_Hyper_L ||
|
||||
keyvals[j] == GDK_KEY_Hyper_R)
|
||||
mask |= EGG_VIRTUAL_HYPER_MASK;
|
||||
else if (keyvals[j] == GDK_Super_L ||
|
||||
keyvals[j] == GDK_Super_R)
|
||||
else if (keyvals[j] == GDK_KEY_Super_L ||
|
||||
keyvals[j] == GDK_KEY_Super_R)
|
||||
mask |= EGG_VIRTUAL_SUPER_MASK;
|
||||
else if (keyvals[j] == GDK_Mode_switch)
|
||||
else if (keyvals[j] == GDK_KEY_Mode_switch)
|
||||
mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
|
||||
|
||||
++j;
|
||||
|
@ -32,8 +32,8 @@
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkwindow.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
struct EggDesktopFile {
|
||||
GKeyFile *key_file;
|
||||
|
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <gdk/gdkscreen.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#include "sugar-key-grabber.h"
|
||||
#include "eggaccelerators.h"
|
||||
@ -160,11 +160,12 @@ sugar_key_grabber_init(SugarKeyGrabber *grabber)
|
||||
static void
|
||||
grab_key_real (Key *key, GdkWindow *root, gboolean grab, int result)
|
||||
{
|
||||
Display *display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default ());
|
||||
if (grab)
|
||||
XGrabKey (GDK_DISPLAY(), key->keycode, (result | key->state),
|
||||
XGrabKey (display, key->keycode, (result | key->state),
|
||||
GDK_WINDOW_XID (root), True, GrabModeAsync, GrabModeAsync);
|
||||
else
|
||||
XUngrabKey(GDK_DISPLAY(), key->keycode, (result | key->state),
|
||||
XUngrabKey(display, key->keycode, (result | key->state),
|
||||
GDK_WINDOW_XID (root));
|
||||
}
|
||||
|
||||
@ -255,7 +256,7 @@ sugar_key_grabber_is_modifier(SugarKeyGrabber *grabber, guint keycode, guint mas
|
||||
gint start, end, i, mod_index;
|
||||
gboolean is_modifier = FALSE;
|
||||
|
||||
xdisplay = gdk_x11_drawable_get_xdisplay(GDK_DRAWABLE (grabber->root));
|
||||
xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default ());
|
||||
|
||||
modmap = XGetModifierMapping(xdisplay);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user