Replace all the deprecated APIs with used in GTK 2.24.x.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 25 Jul 2014 18:33:51 +0000 (21:33 +0300)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 25 Jul 2014 18:41:31 +0000 (21:41 +0300)
Also raise min GTK+ version to 1.18 - that is required by LibFM anyway.

30 files changed:
configure.ac
src/bg.c
src/icon-grid.c
src/misc.c
src/panel.c
src/plugin.c
src/plugins/batt/batt.c
src/plugins/cpu/cpu.c
src/plugins/cpufreq/cpufreq.c
src/plugins/dclock.c
src/plugins/indicator/indicator.c
src/plugins/kbled/kbled.c
src/plugins/launchtaskbar.c
src/plugins/menu.c
src/plugins/monitors/monitors.c
src/plugins/netstat/netstat.c
src/plugins/netstat/statusicon.c
src/plugins/netstat/statusicon.h
src/plugins/netstatus/netstatus-dialog.c
src/plugins/netstatus/netstatus-icon.c
src/plugins/pager.c
src/plugins/separator.c
src/plugins/space.c
src/plugins/thermal/thermal.c
src/plugins/tray.c
src/plugins/volume/volume.c
src/plugins/volumealsa/volumealsa.c
src/plugins/weather/weatherwidget.c
src/plugins/wincmd.c
src/plugins/xkb/xkb.c

index d4ee4d2..b195fd8 100644 (file)
@@ -36,7 +36,7 @@ if test "x$enable_gtk3" = "xyes" ; then
   CFLAGS="$CFLAGS -DENABLE_GTK3"
   pkg_modules="$pkg_modules gtk+-3.0 libfm-gtk3 >= 1.2.0 libwnck-3.0"
 else
-  pkg_modules="$pkg_modules gtk+-2.0 >= 2.16.0 libfm-gtk >= 1.2.0 libwnck-1.0"
+  pkg_modules="$pkg_modules gtk+-2.0 >= 2.18.0 libfm-gtk >= 1.2.0 libwnck-1.0"
 fi
 
 pkg_modules="$pkg_modules \
index 7e88bf0..be670bb 100644 (file)
--- a/src/bg.c
+++ b/src/bg.c
@@ -121,7 +121,7 @@ fb_bg_init (FbBg *bg)
     uint mask;
 
     ENTER;
-    bg->dpy = GDK_DISPLAY();
+    bg->dpy = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
     bg->xroot = DefaultRootWindow(bg->dpy);
     bg->id = gdk_x11_get_xatom_by_name("_XROOTPMAP_ID");
     bg->pixmap = fb_bg_get_xrootpmap(bg);
index 723f25d..ed627e0 100644 (file)
@@ -17,7 +17,6 @@
  */
 
 #include <gtk/gtk.h>
-#include <gtk/gtkprivate.h>
 #include <string.h>
 
 #include "icon-grid.h"
@@ -277,7 +276,7 @@ IconGrid * icon_grid_new(
     /* Create a layout container. */
     ig->widget = gtk_fixed_new();
     g_object_add_weak_pointer(G_OBJECT(ig->widget), (gpointer*)&ig->widget);
-    GTK_WIDGET_SET_FLAGS(ig->widget, GTK_NO_WINDOW);
+    gtk_widget_set_has_window(ig->widget, FALSE);
     gtk_widget_set_redraw_on_allocate(ig->widget, FALSE);
     gtk_container_add(GTK_CONTAINER(ig->container), ig->widget);
     gtk_widget_show(ig->widget);
index 2457972..5a2837a 100644 (file)
@@ -365,7 +365,7 @@ void resolve_atoms()
 
     ENTER;
    
-    if( !  XInternAtoms( GDK_DISPLAY(), (char**)atom_names,
+    if( !  XInternAtoms( GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), (char**)atom_names,
             N_ATOMS, False, atoms ) )
     {
         g_warning( "Error: unable to return Atoms" );
@@ -438,7 +438,7 @@ Xclimsg(Window win, Atom type, long l0, long l1, long l2, long l3, long l4)
     xev.data.l[2] = l2;
     xev.data.l[3] = l3;
     xev.data.l[4] = l4;
-    XSendEvent(GDK_DISPLAY(), GDK_ROOT_WINDOW(), False,
+    XSendEvent(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), GDK_ROOT_WINDOW(), False,
           (SubstructureNotifyMask | SubstructureRedirectMask),
           (XEvent *) &xev);
 }
@@ -454,7 +454,7 @@ Xclimsgwm(Window win, Atom type, Atom arg)
     xev.format = 32;
     xev.data.l[0] = arg;
     xev.data.l[1] = GDK_CURRENT_TIME;
-    XSendEvent(GDK_DISPLAY(), win, False, 0L, (XEvent *) &xev);
+    XSendEvent(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), win, False, 0L, (XEvent *) &xev);
 }
 
 
@@ -471,7 +471,7 @@ get_utf8_property(Window win, Atom atom)
 
     type = None;
     retval = NULL;
-    result = XGetWindowProperty (GDK_DISPLAY(), win, atom, 0, G_MAXLONG, False,
+    result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), win, atom, 0, G_MAXLONG, False,
           a_UTF8_STRING, &type, &format, &nitems,
           &bytes_after, &tmp);
     if (result != Success || type == None)
@@ -498,7 +498,7 @@ get_utf8_property_list(Window win, Atom atom, int *count)
     guchar *tmp = NULL;
 
     *count = 0;
-    result = XGetWindowProperty(GDK_DISPLAY(), win, atom, 0, G_MAXLONG, False,
+    result = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), win, atom, 0, G_MAXLONG, False,
           a_UTF8_STRING, &type, &format, &nitems,
           &bytes_after, &tmp);
     if (result != Success || type != a_UTF8_STRING || tmp == NULL)
@@ -542,7 +542,7 @@ get_xaproperty (Window win, Atom prop, Atom type, int *nitems)
 
     ENTER;
     prop_data = NULL;
-    if (XGetWindowProperty (GDK_DISPLAY(), win, prop, 0, 0x7fffffff, False,
+    if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), win, prop, 0, 0x7fffffff, False,
               type, &type_ret, &format_ret, &items_ret,
               &after_ret, &prop_data) != Success)
     {
@@ -566,7 +566,8 @@ text_property_to_utf8 (const XTextProperty *prop)
 
   ENTER;
   list = NULL;
-  count = gdk_text_property_to_utf8_list (gdk_x11_xatom_to_atom (prop->encoding),
+  count = gdk_text_property_to_utf8_list_for_display (gdk_display_get_default(),
+                                          gdk_x11_xatom_to_atom (prop->encoding),
                                           prop->format,
                                           prop->value,
                                           prop->nitems,
@@ -591,7 +592,7 @@ get_textproperty(Window win, Atom atom)
     char *retval;
 
     ENTER;
-    if (XGetTextProperty(GDK_DISPLAY(), win, &text_prop, atom)) {
+    if (XGetTextProperty(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), win, &text_prop, atom)) {
         DBG("format=%d enc=%d nitems=%d value=%s   \n",
               text_prop.format,
               text_prop.encoding,
@@ -1014,8 +1015,8 @@ get_button_spacing(GtkRequisition *req, GtkContainer *parent, gchar *name)
     ENTER;
     b = gtk_button_new();
     gtk_widget_set_name(GTK_WIDGET(b), name);
-    GTK_WIDGET_UNSET_FLAGS (b, GTK_CAN_FOCUS);
-    GTK_WIDGET_UNSET_FLAGS (b, GTK_CAN_DEFAULT);
+    gtk_widget_set_can_focus(b, FALSE);
+    gtk_widget_set_can_default(b, FALSE);
     gtk_container_set_border_width (GTK_CONTAINER (b), 0);
 
     if (parent)
@@ -1112,7 +1113,7 @@ static GtkWidget *_lxpanel_button_new_for_icon(Panel *panel, FmIcon *icon,
 {
     GtkWidget * event_box = gtk_event_box_new();
     gtk_container_set_border_width(GTK_CONTAINER(event_box), 0);
-    GTK_WIDGET_UNSET_FLAGS(event_box, GTK_CAN_FOCUS);
+    gtk_widget_set_can_focus(event_box, FALSE);
 
     GtkWidget * image = _gtk_image_new_for_icon(icon, size);
     gtk_misc_set_padding(GTK_MISC(image), 0, 0);
@@ -1133,7 +1134,7 @@ static GtkWidget *_lxpanel_button_new_for_icon(Panel *panel, FmIcon *icon,
     {
         GtkWidget * inner = gtk_hbox_new(FALSE, 0);
         gtk_container_set_border_width(GTK_CONTAINER(inner), 0);
-        GTK_WIDGET_UNSET_FLAGS (inner, GTK_CAN_FOCUS);
+        gtk_widget_set_can_focus(inner, FALSE);
         gtk_container_add(GTK_CONTAINER(event_box), inner);
 
         gtk_box_pack_start(GTK_BOX(inner), image, FALSE, FALSE, 0);
index 0a8ee3b..fd1d18f 100644 (file)
@@ -145,6 +145,7 @@ static void panel_normalize_configuration(Panel* p)
 void panel_set_wm_strut(Panel *p)
 {
     int index;
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
     gulong strut_size;
     gulong strut_lower;
     gulong strut_upper;
@@ -202,7 +203,11 @@ void panel_set_wm_strut(Panel *p)
 
     /* If strut value changed, set the property value on the panel window.
      * This avoids property change traffic when the panel layout is recalculated but strut geometry hasn't changed. */
+#if GTK_CHECK_VERSION(2, 20, 0)
+    if ((gtk_widget_get_mapped(p->topgwin))
+#else
     if ((GTK_WIDGET_MAPPED(p->topgwin))
+#endif
     && ((p->strut_size != strut_size) || (p->strut_lower != strut_lower) || (p->strut_upper != strut_upper) || (p->strut_edge != p->edge)))
     {
         p->strut_size = strut_size;
@@ -214,15 +219,15 @@ void panel_set_wm_strut(Panel *p)
          * Set STRUT also for window managers that do not support STRUT_PARTIAL. */
         if (strut_size != 0)
         {
-            XChangeProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_STRUT_PARTIAL,
+            XChangeProperty(xdisplay, p->topxwin, a_NET_WM_STRUT_PARTIAL,
                 XA_CARDINAL, 32, PropModeReplace,  (unsigned char *) desired_strut, 12);
-            XChangeProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_STRUT,
+            XChangeProperty(xdisplay, p->topxwin, a_NET_WM_STRUT,
                 XA_CARDINAL, 32, PropModeReplace,  (unsigned char *) desired_strut, 4);
         }
         else
         {
-            XDeleteProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_STRUT);
-            XDeleteProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_STRUT_PARTIAL);
+            XDeleteProperty(xdisplay, p->topxwin, a_NET_WM_STRUT);
+            XDeleteProperty(xdisplay, p->topxwin, a_NET_WM_STRUT_PARTIAL);
         }
     }
 }
@@ -461,7 +466,11 @@ void panel_update_background(Panel * p)
 static gboolean delay_update_background( Panel* p )
 {
     /* Panel could be destroyed while background update scheduled */
+#if GTK_CHECK_VERSION(2, 20, 0)
+    if (p->topgwin && gtk_widget_get_realized(p->topgwin)) {
+#else
     if ( p->topgwin && GTK_WIDGET_REALIZED ( p->topgwin ) ) {
+#endif
        gdk_display_sync( gtk_widget_get_display(p->topgwin) );
        panel_update_background( p );
     }
@@ -480,7 +489,11 @@ static void
 panel_style_set(GtkWidget *widget, GtkStyle* prev, Panel *p)
 {
     /* FIXME: This dirty hack is used to fix the background of systray... */
+#if GTK_CHECK_VERSION(2, 20, 0)
+    if (gtk_widget_get_realized(widget))
+#else
     if( GTK_WIDGET_REALIZED( widget ) )
+#endif
         g_idle_add_full( G_PRIORITY_LOW, 
                 (GSourceFunc)delay_update_background, p, NULL );
 }
@@ -723,7 +736,7 @@ static void panel_popupmenu_about( GtkMenuItem* item, Panel* panel )
     about = gtk_about_dialog_new();
     panel_apply_icon(GTK_WINDOW(about));
     gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about), VERSION);
-    gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(about), _("LXPanel"));
+    gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(about), _("LXPanel"));
 
     if(gtk_icon_theme_has_icon(panel->icon_theme, "video-display"))
     {
@@ -884,14 +897,16 @@ make_round_corners(Panel *p)
 
 void panel_set_dock_type(Panel *p)
 {
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+
     if (p->setdocktype) {
         Atom state = a_NET_WM_WINDOW_TYPE_DOCK;
-        XChangeProperty(GDK_DISPLAY(), p->topxwin,
+        XChangeProperty(xdisplay, p->topxwin,
                         a_NET_WM_WINDOW_TYPE, XA_ATOM, 32,
                         PropModeReplace, (unsigned char *) &state, 1);
     }
     else {
-        XDeleteProperty( GDK_DISPLAY(), p->topxwin, a_NET_WM_WINDOW_TYPE );
+        XDeleteProperty( xdisplay, p->topxwin, a_NET_WM_WINDOW_TYPE );
     }
 }
 
@@ -1008,6 +1023,7 @@ panel_start_gui(Panel *p)
     Atom state[3];
     XWMHints wmhints;
     guint32 val;
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
 
     ENTER;
 
@@ -1067,11 +1083,11 @@ panel_start_gui(Panel *p)
     /* the settings that should be done before window is mapped */
     wmhints.flags = InputHint;
     wmhints.input = 0;
-    XSetWMHints (GDK_DISPLAY(), p->topxwin, &wmhints);
+    XSetWMHints (xdisplay, p->topxwin, &wmhints);
 #define WIN_HINTS_SKIP_FOCUS      (1<<0)    /* "alt-tab" skips this win */
     val = WIN_HINTS_SKIP_FOCUS;
-    XChangeProperty(GDK_DISPLAY(), p->topxwin,
-          XInternAtom(GDK_DISPLAY(), "_WIN_HINTS", False), XA_CARDINAL, 32,
+    XChangeProperty(xdisplay, p->topxwin,
+          XInternAtom(xdisplay, "_WIN_HINTS", False), XA_CARDINAL, 32,
           PropModeReplace, (unsigned char *) &val, 1);
 
     panel_set_dock_type(p);
@@ -1086,13 +1102,13 @@ panel_start_gui(Panel *p)
     Xclimsg(p->topxwin, a_NET_WM_DESKTOP, 0xFFFFFFFF, 0, 0, 0, 0);
     /* and assign it ourself just for case when wm is not running */
     val = 0xFFFFFFFF;
-    XChangeProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_DESKTOP, XA_CARDINAL, 32,
+    XChangeProperty(xdisplay, p->topxwin, a_NET_WM_DESKTOP, XA_CARDINAL, 32,
           PropModeReplace, (unsigned char *) &val, 1);
 
     state[0] = a_NET_WM_STATE_SKIP_PAGER;
     state[1] = a_NET_WM_STATE_SKIP_TASKBAR;
     state[2] = a_NET_WM_STATE_STICKY;
-    XChangeProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_STATE, XA_ATOM,
+    XChangeProperty(xdisplay, p->topxwin, a_NET_WM_STATE, XA_ATOM,
           32, PropModeReplace, (unsigned char *) state, 3);
 
     calculate_position(p);
@@ -1371,6 +1387,7 @@ int panel_start( Panel *p )
 
 void panel_destroy(Panel *p)
 {
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
     ENTER;
 
     if (p->pref_dialog != NULL)
@@ -1398,8 +1415,8 @@ void panel_destroy(Panel *p)
     g_free( p->background_file );
     g_slist_free( p->system_menus );
     gdk_flush();
-    XFlush(GDK_DISPLAY());
-    XSync(GDK_DISPLAY(), True);
+    XFlush(xdisplay);
+    XSync(xdisplay, True);
 
     g_free( p->name );
     g_free(p);
@@ -1449,7 +1466,7 @@ int panel_handle_x_error(Display * d, XErrorEvent * ev)
     char buf[256];
 
     if (log_level >= LOG_WARN) {
-        XGetErrorText(GDK_DISPLAY(), ev->error_code, buf, 256);
+        XGetErrorText(d, ev->error_code, buf, 256);
         LOG(LOG_WARN, "lxpanel : X error: %s\n", buf);
     }
     return 0;  /* Ignored */
@@ -1499,12 +1516,13 @@ static gboolean check_main_lock()
     gboolean retval = FALSE;
     GtkClipboard *clipboard;
     Atom atom;
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
 
     atom = gdk_x11_get_xatom_by_name(CLIPBOARD_NAME);
 
-    XGrabServer(GDK_DISPLAY());
+    XGrabServer(xdisplay);
 
-    if (XGetSelectionOwner(GDK_DISPLAY(), atom) != None)
+    if (XGetSelectionOwner(xdisplay, atom) != None)
         goto out;
 
     clipboard = gtk_clipboard_get(gdk_atom_intern(CLIPBOARD_NAME, FALSE));
@@ -1516,7 +1534,7 @@ static gboolean check_main_lock()
         retval = TRUE;
 
 out:
-    XUngrabServer (GDK_DISPLAY ());
+    XUngrabServer (xdisplay);
     gdk_flush ();
 
     return retval;
@@ -1686,7 +1704,7 @@ restart:
 */
     gtk_main();
 
-    XSelectInput (GDK_DISPLAY(), GDK_ROOT_WINDOW(), NoEventMask);
+    XSelectInput (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), GDK_ROOT_WINDOW(), NoEventMask);
     gdk_window_remove_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_event_filter, NULL);
 
     /* destroy all panels */
index 746544b..8e54c3c 100644 (file)
@@ -227,11 +227,15 @@ void plugin_widget_set_background(GtkWidget * w, Panel * p)
 {
     if (w != NULL)
     {
-        if ( ! GTK_WIDGET_NO_WINDOW(w))
+        if (gtk_widget_get_has_window(w))
         {
             if ((p->background) || (p->transparent))
             {
+#if GTK_CHECK_VERSION(2, 20, 0)
+                if (gtk_widget_get_realized(w))
+#else
                 if (GTK_WIDGET_REALIZED(w))
+#endif
                 {
                     panel_determine_background_pixmap(p, w, w->window);
                     gdk_window_invalidate_rect(w->window, NULL, TRUE);
@@ -241,7 +245,11 @@ void plugin_widget_set_background(GtkWidget * w, Panel * p)
             {
                 /* Set background according to the current GTK style. */
                 gtk_widget_set_app_paintable(w, FALSE);
+#if GTK_CHECK_VERSION(2, 20, 0)
+                if (gtk_widget_get_realized(w))
+#else
                 if (GTK_WIDGET_REALIZED(w))
+#endif
                 {
                     gdk_window_set_back_pixmap(w->window, NULL, TRUE);
                     gtk_style_set_background(w->style, w->window, GTK_STATE_NORMAL);
index bf31296..455480b 100644 (file)
@@ -413,7 +413,7 @@ static GtkWidget * constructor(Panel *panel, config_setting_t *settings)
 
     p = gtk_event_box_new();
     lxpanel_plugin_set_data(p, lx_b, destructor);
-    GTK_WIDGET_SET_FLAGS( p, GTK_NO_WINDOW );
+    gtk_widget_set_has_window(p, FALSE);
     gtk_container_set_border_width( GTK_CONTAINER(p), 1 );
 
     lx_b->drawingArea = gtk_drawing_area_new();
index 2586159..2f9ba39 100644 (file)
@@ -233,7 +233,7 @@ static GtkWidget *cpu_constructor(Panel *panel, config_setting_t *settings)
     p = gtk_event_box_new();
     lxpanel_plugin_set_data(p, c, cpu_destructor);
     gtk_container_set_border_width(GTK_CONTAINER(p), 1);
-    GTK_WIDGET_SET_FLAGS(p, GTK_NO_WINDOW);
+    gtk_widget_set_has_window(p, FALSE);
 
     /* Allocate drawing area as a child of top level widget.  Enable button press events. */
     c->da = gtk_drawing_area_new();
index aa6ece8..72e1a8a 100644 (file)
@@ -47,7 +47,6 @@ typedef struct {
     GtkWidget *main;
     config_setting_t *settings;
     GtkWidget *namew;
-    GtkTooltips *tip;
     GList *governors;
     GList *cpus;
     int has_cpufreq;
@@ -328,7 +327,7 @@ _update_tooltip(cpufreq *cf)
 
     tooltip = g_strdup_printf(_("Frequency: %d MHz\nGovernor: %s"),
                               cf->cur_freq / 1000, cf->cur_governor);
-    gtk_tooltips_set_tip(cf->tip, cf->main, tooltip, NULL);
+    gtk_widget_set_tooltip_text(cf->main, tooltip);
     g_free(tooltip);
     RET(TRUE);
 }
@@ -354,20 +353,12 @@ static GtkWidget *cpufreq_constructor(Panel *panel, config_setting_t *settings)
 
     cf->main = gtk_event_box_new();
     lxpanel_plugin_set_data(cf->main, cf, cpufreq_destructor);
-#if GTK_CHECK_VERSION(2,18,0)
     gtk_widget_set_has_window(cf->main, FALSE);
-#else
-    GTK_WIDGET_SET_FLAGS(cf->main, GTK_NO_WINDOW);
-#endif
     gtk_container_set_border_width(GTK_CONTAINER(cf->main), 2);
 
     cf->namew = gtk_image_new_from_file(PROC_ICON);
     gtk_container_add(GTK_CONTAINER(cf->main), cf->namew);
 
-    cf->tip = gtk_tooltips_new();
-
-    g_object_ref_sink( cf->tip );
-
     cf->has_cpufreq = 0;
 
     get_cpus(cf);
@@ -409,7 +400,6 @@ cpufreq_destructor(gpointer user_data)
     g_list_free ( cf->cpus );
     g_list_free ( cf->governors );
     g_source_remove(cf->timer);
-    g_object_unref(cf->tip);
     g_free(cf);
 }
 
index 1ff0cb0..e5991b2 100644 (file)
@@ -89,10 +89,10 @@ static GtkWidget * dclock_create_calendar(DClockPlugin * dc)
 
     /* Create a standard calendar widget as a child of the vertical box. */
     GtkWidget * calendar = gtk_calendar_new();
-    gtk_calendar_display_options(
+    gtk_calendar_set_display_options(
         GTK_CALENDAR(calendar),
         GTK_CALENDAR_SHOW_WEEK_NUMBERS | GTK_CALENDAR_SHOW_DAY_NAMES | GTK_CALENDAR_SHOW_HEADING);
-    gtk_box_pack_start_defaults(GTK_BOX(box), calendar);
+    gtk_box_pack_start(GTK_BOX(box), calendar, TRUE, TRUE, 0);
 
     /* Connect signals. */
     g_signal_connect(G_OBJECT(win), "map", G_CALLBACK(dclock_popup_map), dc);
index 090daab..85e9494 100644 (file)
@@ -780,7 +780,7 @@ static GtkWidget *indicator_constructor(Panel *panel, config_setting_t *settings
 
     /* Allocate icon as a child of top level. */
     indicator->menubar = gtk_menu_bar_new();
-    GTK_WIDGET_SET_FLAGS (indicator->menubar, GTK_WIDGET_FLAGS(indicator->menubar) | GTK_CAN_FOCUS);
+    gtk_widget_set_can_focus(indicator->menubar, TRUE);
 
     /* Init some theme/icon stuff */
     gtk_icon_theme_append_search_path(panel_get_icon_theme(panel),
index 9a91b1d..b7e69ce 100644 (file)
@@ -137,6 +137,7 @@ static GtkWidget *kbled_constructor(Panel *panel, config_setting_t *settings)
     GtkWidget *p;
     int i;
     unsigned int current_state;
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
 
     kl->panel = panel;
     kl->settings = settings;
@@ -178,18 +179,18 @@ static GtkWidget *kbled_constructor(Panel *panel, config_setting_t *settings)
         int min = XkbMinorVersion;
         if ( ! XkbLibraryVersion(&maj, &min))
             return 0;
-        if ( ! XkbQueryExtension(GDK_DISPLAY(), &opcode, &xkb_event_base, &xkb_error_base, &maj, &min))
+        if ( ! XkbQueryExtension(xdisplay, &opcode, &xkb_event_base, &xkb_error_base, &maj, &min))
             return 0;
     }
 
     /* Add GDK event filter and enable XkbIndicatorStateNotify events. */
     gdk_window_add_filter(NULL, (GdkFilterFunc) kbled_event_filter, kl);
-    if ( ! XkbSelectEvents(GDK_DISPLAY(), XkbUseCoreKbd, XkbIndicatorStateNotifyMask, XkbIndicatorStateNotifyMask))
+    if ( ! XkbSelectEvents(xdisplay, XkbUseCoreKbd, XkbIndicatorStateNotifyMask, XkbIndicatorStateNotifyMask))
         return 0;
 
     /* Get current indicator state and update display.
      * Force current state to differ in all bits so a full redraw will occur. */
-    XkbGetIndicatorState(GDK_DISPLAY(), XkbUseCoreKbd, &current_state);
+    XkbGetIndicatorState(xdisplay, XkbUseCoreKbd, &current_state);
     kl->current_state = ~ current_state;
     kbled_update_display(kl, current_state);
 
index 19bc6ec..511d279 100644 (file)
@@ -385,11 +385,7 @@ static void launchbutton_build_bootstrap(LaunchTaskBarPlugin *lb)
         /* Create an event box. */
         GtkWidget * event_box = gtk_event_box_new();
         gtk_container_set_border_width(GTK_CONTAINER(event_box), 0);
-#if GTK_CHECK_VERSION(2,18,0)
         gtk_widget_set_can_focus            (event_box, FALSE);
-#else
-        GTK_WIDGET_UNSET_FLAGS(event_box, GTK_CAN_FOCUS);
-#endif
         lb->bootstrap_button->widget = event_box;
         g_signal_connect(event_box, "button-press-event", G_CALLBACK(launchbutton_press_event), lb->bootstrap_button);
 
@@ -503,11 +499,7 @@ static LaunchButton *launchbutton_for_file_info(LaunchTaskBarPlugin * lb, FmFile
     button = lxpanel_button_new_for_fm_icon(lb->panel, fm_file_info_get_icon(fi),
                                             NULL, NULL);
     btn->widget = button;
-#if GTK_CHECK_VERSION(2,18,0)
     gtk_widget_set_can_focus(button, FALSE);
-#else
-    GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
-#endif
 
     gtk_widget_set_tooltip_text(button, fm_file_info_get_disp_name(fi));
 
@@ -844,11 +836,7 @@ static GtkWidget *_launchtaskbar_constructor(Panel *panel, config_setting_t *set
     gtk_container_set_border_width(GTK_CONTAINER(p), 0);
     gtk_container_set_border_width(GTK_CONTAINER(ltbp->p_evbox_launchbar), 0);
     gtk_container_set_border_width(GTK_CONTAINER(ltbp->p_evbox_taskbar), 0);
-#if GTK_CHECK_VERSION(2,18,0)
     gtk_widget_set_has_window(p, FALSE);
-#else
-    GTK_WIDGET_SET_FLAGS(p, GTK_NO_WINDOW);
-#endif
 
     /* Read parameters from the configuration file. */
     config_setting_lookup_int(settings, "LaunchTaskBarMode", &ltbp->mode);
@@ -1813,7 +1801,7 @@ static void task_set_class(Task * tk)
     XClassHint ch;
     ch.res_name = NULL;
     ch.res_class = NULL;
-    XGetClassHint(GDK_DISPLAY(), tk->win, &ch);
+    XGetClassHint(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), tk->win, &ch);
 
     /* If the res_name was returned, free it.  We make no use of it at this time. */
     if (ch.res_name != NULL)
@@ -1928,7 +1916,11 @@ static void task_delete(LaunchTaskBarPlugin * tb, Task * tk, gboolean unlink, gb
 static GdkPixbuf * _wnck_gdk_pixbuf_get_from_pixmap(Pixmap xpixmap, int width, int height)
 {
     /* Get the drawable. */
+#if GTK_CHECK_VERSION(2, 24, 0)
+    GdkDrawable * drawable = gdk_x11_window_lookup_for_display(gdk_display_get_default(), xpixmap);
+#else
     GdkDrawable * drawable = gdk_xid_table_lookup(xpixmap);
+#endif
     if (drawable != NULL)
         g_object_ref(G_OBJECT(drawable));
     else
@@ -1948,7 +1940,11 @@ static GdkPixbuf * _wnck_gdk_pixbuf_get_from_pixmap(Pixmap xpixmap, int width, i
             colormap = NULL;
         else
         {
+#if GTK_CHECK_VERSION(2, 24, 0)
+            colormap = gdk_screen_get_system_colormap(gdk_window_get_screen(drawable));
+#else
             colormap = gdk_screen_get_system_colormap(gdk_drawable_get_screen(drawable));
+#endif
             g_object_ref(G_OBJECT(colormap));
         }
 
@@ -2013,6 +2009,7 @@ static GdkPixbuf * get_wm_icon(Window task_win, guint required_width, guint requ
     GdkPixbuf * pixmap = NULL;
     Atom possible_source = None;
     int result = -1;
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
 
     if ((source == None) || (source == a_NET_WM_ICON))
     {
@@ -2035,7 +2032,7 @@ static GdkPixbuf * get_wm_icon(Window task_win, guint required_width, guint requ
         gulong bytes_after;
         gulong * data = NULL;
         result = XGetWindowProperty(
-            GDK_DISPLAY(),
+            xdisplay,
             task_win,
             a_NET_WM_ICON,
             0, G_MAXLONG,
@@ -2135,7 +2132,7 @@ static GdkPixbuf * get_wm_icon(Window task_win, guint required_width, guint requ
     if ((result != Success) && (*current_source != a_NET_WM_ICON)
     && ((source == None) || (source != a_NET_WM_ICON)))
     {
-        XWMHints * hints = XGetWMHints(GDK_DISPLAY(), task_win);
+        XWMHints * hints = XGetWMHints(xdisplay, task_win);
         result = (hints != NULL) ? Success : -1;
         Pixmap xpixmap = None;
         Pixmap xmask = None;
@@ -2167,7 +2164,7 @@ static GdkPixbuf * get_wm_icon(Window task_win, guint required_width, guint requ
             Pixmap *icons = NULL;
             Atom kwin_win_icon_atom = gdk_x11_get_xatom_by_name("KWM_WIN_ICON");
             result = XGetWindowProperty(
-                GDK_DISPLAY(),
+                xdisplay,
                 task_win,
                 kwin_win_icon_atom,
                 0, G_MAXLONG,
@@ -2205,7 +2202,7 @@ static GdkPixbuf * get_wm_icon(Window task_win, guint required_width, guint requ
             int unused;
             unsigned int unused_2;
             result = XGetGeometry(
-                GDK_DISPLAY(), xpixmap,
+                xdisplay, xpixmap,
                 &unused_win, &unused, &unused, &w, &h, &unused_2, &unused_2) ? Success : -1;
         }
 
@@ -2224,7 +2221,7 @@ static GdkPixbuf * get_wm_icon(Window task_win, guint required_width, guint requ
             int unused;
             unsigned int unused_2;
             if (XGetGeometry(
-                GDK_DISPLAY(), xmask,
+                xdisplay, xmask,
                 &unused_win, &unused, &unused, &w, &h, &unused_2, &unused_2))
             {
                 /* Convert the X mask to a GDK pixmap. */
@@ -2343,6 +2340,8 @@ static void task_clear_urgency(Task * tk)
  * We also switch the active desktop and viewport if needed. */
 static void task_raise_window(Task * tk, guint32 time)
 {
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+
     /* Change desktop if needed. */
     if ((tk->desktop != ALL_WORKSPACES) && (tk->desktop != tk->tb->current_desktop))
         Xclimsg(GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, tk->desktop, 0, 0, 0, 0);
@@ -2362,23 +2361,28 @@ static void task_raise_window(Task * tk, guint32 time)
         Xclimsg(tk->win, a_NET_ACTIVE_WINDOW, 2, time, 0, 0, 0);
     else
     {
+#if GTK_CHECK_VERSION(2, 24, 0)
+        GdkWindow * gdkwindow = gdk_x11_window_lookup_for_display(gdk_display_get_default(), tk->win);
+#else
         GdkWindow * gdkwindow = gdk_xid_table_lookup(tk->win);
+#endif
         if (gdkwindow != NULL)
             gdk_window_show(gdkwindow);
         else
-            XMapRaised(GDK_DISPLAY(), tk->win);
+            XMapRaised(xdisplay, tk->win);
 
     /* There is a race condition between the X server actually executing the XMapRaised and this code executing XSetInputFocus.
      * If the window is not viewable, the XSetInputFocus will fail with BadMatch. */
     XWindowAttributes attr;
-    XGetWindowAttributes(GDK_DISPLAY(), tk->win, &attr);
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+    XGetWindowAttributes(xdisplay, tk->win, &attr);
     if (attr.map_state == IsViewable)
-            XSetInputFocus(GDK_DISPLAY(), tk->win, RevertToNone, time);
+            XSetInputFocus(xdisplay, tk->win, RevertToNone, time);
     }
 
     /* Change viewport if needed. */
     XWindowAttributes xwa;
-    XGetWindowAttributes(GDK_DISPLAY(), tk->win, &xwa);
+    XGetWindowAttributes(xdisplay, tk->win, &xwa);
     Xclimsg(tk->win, a_NET_DESKTOP_VIEWPORT, xwa.x, xwa.y, 0, 0, 0);
 }
 
@@ -2483,6 +2487,7 @@ static gboolean taskbar_task_control_event(GtkWidget * widget, GdkEventButton *
 
         if (event->button == 1)
         {
+            Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
             /* Left button.
              * If the task is iconified, raise it.
              * If the task is not iconified and has focus, iconify it.
@@ -2490,7 +2495,7 @@ static gboolean taskbar_task_control_event(GtkWidget * widget, GdkEventButton *
             if (tk->iconified)
                 task_raise_window(tk, event->time);
             else if ((tk->focused) || (tk == tb->focused_previous))
-                XIconifyWindow(GDK_DISPLAY(), tk->win, DefaultScreen(GDK_DISPLAY()));
+                XIconifyWindow(xdisplay, tk->win, DefaultScreen(xdisplay));
             else
                 task_raise_window(tk, event->time);
         }
@@ -2637,7 +2642,10 @@ static gboolean taskbar_button_scroll_event(GtkWidget * widget, GdkEventScroll *
         if ((event->direction == GDK_SCROLL_UP) || (event->direction == GDK_SCROLL_LEFT))
             task_raise_window(tk, event->time);
         else
-            XIconifyWindow(GDK_DISPLAY(), tk->win, DefaultScreen(GDK_DISPLAY()));
+        {
+            Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+            XIconifyWindow(xdisplay, tk->win, DefaultScreen(xdisplay));
+        }
     }
     return TRUE;
 }
@@ -2645,7 +2653,11 @@ static gboolean taskbar_button_scroll_event(GtkWidget * widget, GdkEventScroll *
 /* Handler for "size-allocate" event from taskbar button. */
 static void taskbar_button_size_allocate(GtkWidget * btn, GtkAllocation * alloc, Task * tk)
 {
+#if GTK_CHECK_VERSION(2, 20, 0)
+    if (gtk_widget_get_realized(btn))
+#else
     if (GTK_WIDGET_REALIZED(btn))
+#endif
     {
         /* Get the coordinates of the button. */
         int x, y;
@@ -2662,7 +2674,7 @@ static void taskbar_button_size_allocate(GtkWidget * btn, GtkAllocation * alloc,
         data[1] = y;
         data[2] = alloc->width;
         data[3] = alloc->height;
-        XChangeProperty(GDK_DISPLAY(), tk->win,
+        XChangeProperty(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), tk->win,
             gdk_x11_get_xatom_by_name("_NET_WM_ICON_GEOMETRY"),
             XA_CARDINAL, 32, PropModeReplace, (guchar *) &data, 4);
     }
@@ -2701,14 +2713,20 @@ static void task_update_style(Task * tk, LaunchTaskBarPlugin * tb)
 /* Build graphic elements needed for a task button. */
 static void task_build_gui(LaunchTaskBarPlugin * tb, Task * tk)
 {
+    GdkDisplay *display = gdk_display_get_default();
     /* NOTE
      * 1. the extended mask is sum of taskbar and pager needs
      * see bug [ 940441 ] pager loose track of windows
      *
      * Do not change event mask to gtk windows spawned by this gtk client
      * this breaks gtk internals */
+#if GTK_CHECK_VERSION(2, 24, 0)
+    if (!gdk_x11_window_lookup_for_display(display, tk->win))
+#else
     if (! gdk_window_lookup(tk->win))
-        XSelectInput(GDK_DISPLAY(), tk->win, PropertyChangeMask | StructureNotifyMask);
+#endif
+        XSelectInput(GDK_DISPLAY_XDISPLAY(display), tk->win,
+                     PropertyChangeMask | StructureNotifyMask);
 
     /* Allocate a toggle button as the top level widget. */
     tk->button = gtk_toggle_button_new();
@@ -2749,13 +2767,8 @@ static void task_build_gui(LaunchTaskBarPlugin * tb, Task * tk)
 
     /* Add the button to the taskbar. */
     icon_grid_add(tb->tb_icon_grid, tk->button, TRUE);
-#if GTK_CHECK_VERSION(2,18,0)
     gtk_widget_set_can_focus(GTK_WIDGET(tk->button),FALSE);
     gtk_widget_set_can_default(GTK_WIDGET(tk->button),FALSE);
-#else
-    GTK_WIDGET_UNSET_FLAGS(tk->button, GTK_CAN_FOCUS);
-    GTK_WIDGET_UNSET_FLAGS(tk->button, GTK_CAN_DEFAULT);
-#endif
 
     /* Update styles on the button. */
     task_update_style(tk, tb);
@@ -2777,7 +2790,7 @@ static gint get_window_monitor(Window win)
     gwin = gdk_x11_window_foreign_new_for_display(display,win);
     g_assert(gwin);
     m = gdk_screen_get_monitor_at_window(gdk_window_get_screen(gwin),gwin);
-    gdk_window_unref(gwin);
+    g_object_unref(gwin);
     return m;
 }
 
@@ -3148,32 +3161,45 @@ static void menu_raise_window(GtkWidget * widget, LaunchTaskBarPlugin * tb)
 {
     if ((tb->menutask->desktop != ALL_WORKSPACES) && (tb->menutask->desktop != tb->current_desktop))
         Xclimsg(GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, tb->menutask->desktop, 0, 0, 0, 0);
-    XMapRaised(GDK_DISPLAY(), tb->menutask->win);
+    XMapRaised(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), tb->menutask->win);
     task_group_menu_destroy(tb);
 }
 
 /* Handler for "activate" event on Restore item of right-click menu for task buttons. */
 static void menu_restore_window(GtkWidget * widget, LaunchTaskBarPlugin * tb)
 {
+#if GTK_CHECK_VERSION(2, 24, 0)
+    GdkWindow * win = gdk_x11_window_foreign_new_for_display(gdk_display_get_default(),
+                                                             tb->menutask->win);
+#else
     GdkWindow * win = gdk_window_foreign_new(tb->menutask->win);
+#endif
+
     gdk_window_unmaximize(win);
-    gdk_window_unref(win);
+    g_object_unref(win);
     task_group_menu_destroy(tb);
 }
 
 /* Handler for "activate" event on Maximize item of right-click menu for task buttons. */
 static void menu_maximize_window(GtkWidget * widget, LaunchTaskBarPlugin * tb)
 {
+#if GTK_CHECK_VERSION(2, 24, 0)
+    GdkWindow * win = gdk_x11_window_foreign_new_for_display(gdk_display_get_default(),
+                                                             tb->menutask->win);
+#else
     GdkWindow * win = gdk_window_foreign_new(tb->menutask->win);
+#endif
+
     gdk_window_maximize(win);
-    gdk_window_unref(win);
+    g_object_unref(win);
     task_group_menu_destroy(tb);
 }
 
 /* Handler for "activate" event on Iconify item of right-click menu for task buttons. */
 static void menu_iconify_window(GtkWidget * widget, LaunchTaskBarPlugin * tb)
 {
-    XIconifyWindow(GDK_DISPLAY(), tb->menutask->win, DefaultScreen(GDK_DISPLAY()));
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+    XIconifyWindow(xdisplay, tb->menutask->win, DefaultScreen(xdisplay));
     task_group_menu_destroy(tb);
 }
 
index 044e86f..03ebd63 100644 (file)
@@ -152,10 +152,9 @@ menu_pos(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, GtkWidget *widget)
 {
     int ox, oy, w, h;
     menup *m;
-#if GTK_CHECK_VERSION(2,18,0)
-    GtkAllocation *allocation = g_new0 (GtkAllocation, 1);
-    gtk_widget_get_allocation(GTK_WIDGET(widget), allocation);
-#endif
+    GtkAllocation allocation;
+
+    gtk_widget_get_allocation(GTK_WIDGET(widget), &allocation);
     ENTER;
     m = g_object_get_data(G_OBJECT(widget), "plugin");
     gdk_window_get_origin(gtk_widget_get_window(widget), &ox, &oy);
@@ -172,45 +171,22 @@ menu_pos(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, GtkWidget *widget)
     if (panel_get_orientation(m->panel) == GTK_ORIENTATION_HORIZONTAL) {
         *x = ox;
         if (*x + w > gdk_screen_width())
-#if GTK_CHECK_VERSION(2,18,0)
-            *x = ox + allocation->width - w;
-#else
-            *x = ox + widget->allocation.width - w;
-#endif
+            *x = ox + allocation.width - w;
         *y = oy - h;
         if (*y < 0)
-#if GTK_CHECK_VERSION(2,18,0)
-            *y = oy + allocation->height;
-#else
-            *y = oy + widget->allocation.height;
-#endif
+            *y = oy + allocation.height;
     } else {
-#if GTK_CHECK_VERSION(2,18,0)
-        *x = ox + allocation->width;
-#else
-        *x = ox + widget->allocation.width;
-#endif
+        *x = ox + allocation.width;
         if (*x > gdk_screen_width())
             *x = ox - w;
         *y = oy;
         if (*y + h >  gdk_screen_height())
-#if GTK_CHECK_VERSION(2,18,0)
-            *y = oy + allocation->height - h;
-#else
-            *y = oy + widget->allocation.height - h;
-#endif
+            *y = oy + allocation.height - h;
     }
     DBG("widget: x,y=%d,%d  w,h=%d,%d\n", ox, oy,
-#if GTK_CHECK_VERSION(2,18,0)
-          allocation->width, allocation->height );
-#else
-          widget->allocation.width, widget->allocation.height );
-#endif
+          allocation.width, allocation.height );
     DBG("w-h %d %d\n", w, h);
     *push_in = TRUE;
-#if GTK_CHECK_VERSION(2,18,0)
-    g_free (allocation);
-#endif
     RET();
 }
 
@@ -348,7 +324,11 @@ static void restore_grabs(GtkWidget *w, gpointer data)
 
         while (tmp)
         {
+#if GTK_CHECK_VERSION(2, 24, 0)
+            if (!gtk_widget_get_mapped(tmp))
+#else
             if (!GTK_WIDGET_MAPPED (tmp))
+#endif
             {
                 viewable = FALSE;
                 break;
@@ -363,11 +343,7 @@ static void restore_grabs(GtkWidget *w, gpointer data)
     }
 
     /*only grab if this HAD a grab before*/
-#if GTK_CHECK_VERSION(2,18,0)
     if (xgrab_shell && (gtk_widget_has_focus(xgrab_shell)))
-#else
-    if (xgrab_shell && (GTK_MENU_SHELL (xgrab_shell)->have_xgrab))
-#endif
      {
         if (gdk_pointer_grab (gtk_widget_get_window(xgrab_shell), TRUE,
                     GDK_BUTTON_PRESS_MASK |
@@ -378,11 +354,7 @@ static void restore_grabs(GtkWidget *w, gpointer data)
         {
             if (gdk_keyboard_grab (gtk_widget_get_window(xgrab_shell), TRUE,
                     GDK_CURRENT_TIME) == 0)
-#if GTK_CHECK_VERSION(2,18,0)
                 gtk_widget_grab_focus (xgrab_shell);
-#else
-                GTK_MENU_SHELL (xgrab_shell)->have_xgrab = TRUE;
-#endif
             else
                 gdk_pointer_ungrab (GDK_CURRENT_TIME);
         }
@@ -556,7 +528,11 @@ static void _unload_old_icons(GtkMenu* menu, GtkIconTheme* theme, menup* m)
             {
                img = GTK_IMAGE(gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(item)));
                 gtk_image_clear(img);
+#if GTK_CHECK_VERSION(2, 24, 0)
+                if (gtk_widget_get_mapped(GTK_WIDGET(img)))
+#else
                 if( GTK_WIDGET_MAPPED(img) )
+#endif
                    on_menu_item_map(GTK_WIDGET(item), m);
             }
         }
@@ -662,28 +638,18 @@ static gboolean
 my_button_pressed(GtkWidget *widget, GdkEventButton *event, menup *m)
 {
     ENTER;
-#if GTK_CHECK_VERSION(2,18,0)
-    GtkAllocation *allocation = g_new0 (GtkAllocation, 1);
-    gtk_widget_get_allocation(GTK_WIDGET(widget), allocation);
-#endif
+    GtkAllocation allocation;
+    gtk_widget_get_allocation(GTK_WIDGET(widget), &allocation);
 
     /* Standard right-click handling. */
     if (lxpanel_plugin_button_press_event(m->box, event, m->panel))
         return TRUE;
 
     if ((event->type == GDK_BUTTON_PRESS)
-#if GTK_CHECK_VERSION(2,18,0)
-          && (event->x >=0 && event->x < allocation->width)
-          && (event->y >=0 && event->y < allocation->height)) {
-#else
-          && (event->x >=0 && event->x < widget->allocation.width)
-          && (event->y >=0 && event->y < widget->allocation.height)) {
-#endif
+          && (event->x >=0 && event->x < allocation.width)
+          && (event->y >=0 && event->y < allocation.height)) {
         show_menu( widget, m, event->button, event->time );
     }
-#if GTK_CHECK_VERSION(2,18,0)
-    g_free (allocation);
-#endif
     RET(TRUE);
 }
 
index 3a39716..c5e66c1 100644 (file)
@@ -621,7 +621,7 @@ monitors_constructor(Panel *panel, config_setting_t *settings)
     p = gtk_hbox_new(TRUE, 2);
     lxpanel_plugin_set_data(p, mp, monitors_destructor);
     gtk_container_set_border_width(GTK_CONTAINER(p), 1);
-    GTK_WIDGET_SET_FLAGS(p, GTK_NO_WINDOW);
+    gtk_widget_set_has_window(p, FALSE);
 
     /* First time we use this plugin : only display CPU usage */
     mp->displayed_monitors[CPU_POSITION] = 1;
index 7f5676b..34119ba 100644 (file)
@@ -198,7 +198,7 @@ wireless_menu(netdev_info *ni)
 
             /* add this item to menu */
             gtk_container_add(GTK_CONTAINER(menu_item), item_box);
-            gtk_menu_append(GTK_MENU(menu), menu_item);
+            gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
             g_signal_connect(G_OBJECT(menu_item), "activate", G_CALLBACK(wireless_connect), aps);
             g_object_weak_ref(G_OBJECT(menu_item), g_free_weaknotify, aps);
 
@@ -212,7 +212,7 @@ wireless_menu(netdev_info *ni)
         gtk_label_set_justify(GTK_LABEL(wireless_label), GTK_JUSTIFY_LEFT);
         gtk_widget_set_sensitive(GTK_WIDGET(wireless_label), FALSE);
         gtk_container_add(GTK_CONTAINER(menu_item), wireless_label);
-        gtk_menu_append(GTK_MENU(menu), menu_item);
+        gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
     }
 
     gtk_widget_show_all(menu);
@@ -464,7 +464,7 @@ static GtkWidget *netstat_constructor(Panel *panel, config_setting_t *settings)
 
     p = gtk_event_box_new();
     lxpanel_plugin_set_data(p, ns, netstat_destructor);
-    GTK_WIDGET_SET_FLAGS(p, GTK_NO_WINDOW);
+    gtk_widget_set_has_window(p, FALSE);
     gtk_container_add((GtkContainer*)p, ns->mainw);
 
     RET(p);
index 3d273f1..78ea4b8 100644 (file)
@@ -32,7 +32,7 @@ struct statusicon *create_statusicon(GtkWidget *box, const char *filename,
     /* main */
     newicon->main = gtk_event_box_new();
 
-    GTK_WIDGET_SET_FLAGS(newicon->main, GTK_NO_WINDOW);
+    gtk_widget_set_has_window(newicon->main, FALSE);
     gtk_widget_add_events(newicon->main, GDK_BUTTON_PRESS_MASK);
     gtk_widget_set_size_request(newicon->main, 24, 24);
     gtk_box_pack_start(GTK_BOX(box), newicon->main, TRUE, TRUE, 0);
@@ -56,9 +56,7 @@ struct statusicon *create_statusicon(GtkWidget *box, const char *filename,
     gtk_widget_show_all(newicon->main);
 
     /* tooltip */
-    newicon->tooltips = gtk_tooltips_new();
-    g_object_ref_sink(newicon->tooltips);
-    gtk_tooltips_set_tip(newicon->tooltips, newicon->main, tooltips, NULL);
+    gtk_widget_set_tooltip_text(newicon->main, tooltips);
 
     return newicon;
 }
@@ -68,7 +66,6 @@ void statusicon_destroy(struct statusicon *icon)
        if (icon==NULL)
         return;
 
-    g_object_unref(icon->tooltips);
     gtk_widget_destroy(GTK_WIDGET(icon->icon));
     gtk_widget_destroy(GTK_WIDGET(icon->main));
     g_free(icon);
@@ -82,7 +79,7 @@ void set_statusicon_image_from_file(struct statusicon *widget, const char *filen
 
 void set_statusicon_tooltips(struct statusicon *widget, const char *tooltips)
 {
-    gtk_tooltips_set_tip(widget->tooltips, widget->main, tooltips, NULL);
+    gtk_widget_set_tooltip_text(widget->main, tooltips);
 }
 
 void set_statusicon_visible(struct statusicon *widget, gboolean b)
index 3389d6a..7ead050 100644 (file)
@@ -7,7 +7,6 @@
 struct statusicon {
         GtkWidget *main;
         GtkWidget *icon;
-        GtkTooltips *tooltips;
 };
 
 struct statusicon *create_statusicon(GtkWidget *box, const char *filename,
index 61e798c..672887c 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <glib/gi18n.h>
 #include "netstatus-dialog.h"
+#include <libfm/fm-gtk.h>
 
 #include <string.h>
 /* #include <gconf/gconf-client.h> */
@@ -539,8 +540,6 @@ static void
 netstatus_iface_configure (GtkWidget           *configure_button,
                           NetstatusDialogData *dialog_data)
 {
-  GError     *error;
-  GdkScreen  *screen;
   GString    *command;
   char      **argv = NULL;
   int         i;
@@ -566,29 +565,8 @@ netstatus_iface_configure (GtkWidget           *configure_button,
        command = g_string_append (command, argv [i]);
     }
 
-  screen = gtk_window_get_screen (GTK_WINDOW (dialog_data->dialog));
-
-  error = NULL;
-  if (!gdk_spawn_command_line_on_screen (screen, command->str, &error))
-    {
-      GtkWidget *error_dialog;
-
-      error_dialog = gtk_message_dialog_new (NULL,
-                                            GTK_DIALOG_DESTROY_WITH_PARENT,
-                                            GTK_MESSAGE_ERROR,
-                                            GTK_BUTTONS_OK,
-                                            _("Failed to launch time configuration tool: %s"),
-                                            error->message);
-      g_signal_connect (error_dialog, "response",
-                       G_CALLBACK (gtk_widget_destroy), NULL);
-
-      gtk_window_set_resizable (GTK_WINDOW (error_dialog), FALSE);
-      gtk_window_set_screen (GTK_WINDOW (error_dialog), screen);
-      
-      gtk_widget_show_all (error_dialog);
-
-      g_error_free (error);
-    }
+  fm_launch_command_simple(GTK_WINDOW (dialog_data->dialog), NULL,
+                           G_APP_INFO_CREATE_NONE, command->str, NULL);
 
   g_string_free (command, TRUE);
   g_strfreev (argv);
@@ -632,7 +610,11 @@ netstatus_dialog_setup_connection (NetstatusDialogData *data)
   data->name_entry = gtk_bin_get_child((GtkBin*)data->name);
   model = gtk_list_store_new(1, G_TYPE_STRING);
   gtk_combo_box_set_model(GTK_COMBO_BOX(data->name), GTK_TREE_MODEL(model));
+#if GTK_CHECK_VERSION(2, 24, 0)
+  gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(data->name), 0);
+#else
   gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(data->name), 0);
+#endif
   g_object_unref(model);
 
   data->status = (GtkWidget*)gtk_builder_get_object(data->builder, "status_label");
index ca754b7..faff033 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include <gtk/gtktooltips.h>
 
 #include "netstatus-util.h"
 #include "netstatus-enums.h"
@@ -579,7 +578,7 @@ netstatus_icon_scale_icons (NetstatusIcon  *icon,
 static inline GObjectClass *
 get_box_class (GtkOrientation orientation)
 {
-  return gtk_type_class (orientation == GTK_ORIENTATION_HORIZONTAL ? GTK_TYPE_HBOX : GTK_TYPE_VBOX);
+  return g_type_class_peek(orientation == GTK_ORIENTATION_HORIZONTAL ? GTK_TYPE_HBOX : GTK_TYPE_VBOX);
 }
 
 static void
@@ -618,7 +617,11 @@ netstatus_icon_size_allocate (GtkWidget     *widget,
       netstatus_icon_scale_icons (icon, size);
     }
 
+#if GTK_CHECK_VERSION(2, 20, 0)
+  if (gtk_widget_get_realized(widget))
+#else
   if (GTK_WIDGET_REALIZED (widget))
+#endif
     {
       gdk_window_move_resize (window,
                               allocation->x + border_width,
@@ -637,11 +640,7 @@ netstatus_icon_size_allocate (GtkWidget     *widget,
   if (GTK_WIDGET_CLASS (klass)->size_allocate)
     GTK_WIDGET_CLASS (klass)->size_allocate (widget, &child_allocation);
 
-#if GTK_CHECK_VERSION(2,18,0)
   gtk_widget_get_allocation(widget, allocation);
-#else
-  widget->allocation = *allocation;
-#endif
 }
 
 static void
@@ -651,7 +650,11 @@ netstatus_icon_realize (GtkWidget *widget)
   int           attributes_mask;
   int           border_width;
 
+#if GTK_CHECK_VERSION(2, 20, 0)
+  gtk_widget_set_realized(widget, TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+#endif
 
   border_width = GTK_CONTAINER (widget)->border_width;
 
@@ -858,7 +861,7 @@ netstatus_icon_instance_init (NetstatusIcon      *icon,
 {
   icon->priv = g_new0 (NetstatusIconPrivate, 1);
 
-  GTK_WIDGET_UNSET_FLAGS (icon, GTK_NO_WINDOW);
+  gtk_widget_set_has_window(GTK_WIDGET(icon), TRUE);
 
   icon->priv->iface            = NULL;
   icon->priv->state            = NETSTATUS_STATE_DISCONNECTED;
index 1b971ad..6ccd30b 100644 (file)
@@ -60,7 +60,7 @@ static GtkWidget *pager_constructor(Panel *panel, config_setting_t *settings)
     w = wnck_pager_new(NULL);
     g_return_val_if_fail(w != NULL, 0);
     p = gtk_event_box_new();
-    GTK_WIDGET_SET_FLAGS(p, GTK_NO_WINDOW);
+    gtk_widget_set_has_window(p, FALSE);
 
     /* we cannot configure pager until it added into widgets hierarchy */
     g_signal_connect(p, "realize", G_CALLBACK(on_realize), panel);
index cd7dd53..132b6ea 100644 (file)
@@ -27,11 +27,7 @@ static GtkWidget *separator_constructor(Panel *panel, config_setting_t *settings
 
     /* Allocate top level widget and set into Plugin widget pointer. */
     instance = gtk_event_box_new();
-#if GTK_CHECK_VERSION(2,18,0)
     gtk_widget_set_has_window(instance, FALSE);
-#else
-    GTK_WIDGET_SET_FLAGS(instance, GTK_NO_WINDOW);
-#endif
     gtk_widget_add_events(instance, GDK_BUTTON_PRESS_MASK);
     gtk_container_set_border_width(GTK_CONTAINER(instance), 1);
 
index fac4142..ed3c3ec 100644 (file)
@@ -53,11 +53,7 @@ static GtkWidget *space_constructor(Panel *panel, config_setting_t *settings)
     /* Allocate top level widget and set into Plugin widget pointer. */
     p = gtk_event_box_new();
     lxpanel_plugin_set_data(p, sp, g_free);
-#if GTK_CHECK_VERSION(2,18,0)
     gtk_widget_set_has_window(p,FALSE);
-#else
-    GTK_WIDGET_SET_FLAGS(p, GTK_NO_WINDOW);
-#endif
     gtk_widget_add_events(p, GDK_BUTTON_PRESS_MASK);
     gtk_container_set_border_width(GTK_CONTAINER(p), 0);
 
index 5dd1f3a..51ca7dc 100644 (file)
@@ -421,7 +421,7 @@ thermal_constructor(Panel *panel, config_setting_t *settings)
 
     p = gtk_event_box_new();
     lxpanel_plugin_set_data(p, th, thermal_destructor);
-    GTK_WIDGET_SET_FLAGS( p, GTK_NO_WINDOW );
+    gtk_widget_set_has_window(p, FALSE);
     gtk_container_set_border_width( GTK_CONTAINER(p), 2 );
 
     th->namew = gtk_label_new("ww");
index 9aecbc1..c73e79e 100644 (file)
@@ -642,11 +642,7 @@ static GtkWidget *tray_constructor(Panel *panel, config_setting_t *settings)
     /* Allocate top level widget and set into Plugin widget pointer. */
     tr->plugin = p = gtk_event_box_new();
     lxpanel_plugin_set_data(p, tr, tray_destructor);
-#if GTK_CHECK_VERSION(2,18,0)
     gtk_widget_set_has_window(p,FALSE);
-#else
-    GTK_WIDGET_SET_FLAGS(p, GTK_NO_WINDOW);
-#endif
     gtk_widget_set_name(p, "tray");
     gtk_container_set_border_width(GTK_CONTAINER(p), 1);
 
index ea06542..ac03134 100644 (file)
@@ -44,7 +44,6 @@ static gboolean skip_botton1_event;
 typedef struct {
     Panel *panel;
     GtkWidget *dlg;
-    GtkTooltips* tooltips;
 } volume_t;
 
 static void
@@ -55,7 +54,6 @@ volume_destructor(gpointer user_data)
     ENTER;
     if (vol->dlg)
         gtk_widget_destroy(vol->dlg);
-    g_object_unref( vol->tooltips );
     if (mixer_fd)
         close(mixer_fd);
     g_free(vol);
@@ -283,11 +281,8 @@ _error:
     gtk_widget_destroy( vol->dlg );
     vol->dlg = NULL;
 
-    vol->tooltips = gtk_tooltips_new ();
-    g_object_ref_sink( vol->tooltips );
-
     /* FIXME: display current level in tooltip. ex: "Volume Control: 80%"  */
-    gtk_tooltips_set_tip (vol->tooltips, p, _("Volume control"), NULL);
+    gtk_widget_set_tooltip_text(p, _("Volume control"));
 
     RET(p);
 }
index 7bee208..02bc5f7 100644 (file)
@@ -484,7 +484,7 @@ static void volumealsa_build_popup_window(GtkWidget *p)
     gtk_container_set_border_width (GTK_CONTAINER(scrolledwindow), 0);
     gtk_widget_show(scrolledwindow);
     gtk_container_add(GTK_CONTAINER(vol->popup_window), scrolledwindow);
-    GTK_WIDGET_UNSET_FLAGS(scrolledwindow, GTK_CAN_FOCUS);
+    gtk_widget_set_can_focus(scrolledwindow, FALSE);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
     gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_SHADOW_NONE);
 
@@ -582,8 +582,6 @@ static void volumealsa_destructor(gpointer user_data)
 
 static GtkWidget *volumealsa_configure(Panel *panel, GtkWidget *p, GtkWindow *parent)
 {
-    GdkScreen *screen = gdk_screen_get_default();
-    GError *error = NULL;
     const gchar *command_line = NULL;
 
     if (g_find_program_in_path("pulseaudio"))
@@ -623,9 +621,8 @@ static GtkWidget *volumealsa_configure(Panel *panel, GtkWidget *p, GtkWindow *pa
 
     if (command_line)
     {
-        gdk_spawn_command_line_on_screen(screen,
-                                         command_line,
-                                         &error);
+        fm_launch_command_simple(NULL, NULL, G_APP_INFO_CREATE_NONE,
+                                 command_line, NULL);
     }
     else
     {
@@ -634,12 +631,6 @@ static GtkWidget *volumealsa_configure(Panel *panel, GtkWidget *p, GtkWindow *pa
                       NULL);
     }
 
-    if (error)
-    {
-        g_print("%s\n", error->message);
-        g_free (error);
-    }
-
     return NULL;
 }
 
index 03816d7..c06a0a7 100644 (file)
@@ -427,7 +427,11 @@ gtk_weather_size_allocate(GtkWidget * widget, GtkAllocation * allocation)
 
   gboolean weather_has_window = gtk_widget_get_has_window(widget);
 
+#if GTK_CHECK_VERSION(2, 20, 0)
+  if (gtk_widget_get_realized(widget) && weather_has_window)
+#else
   if (GTK_WIDGET_REALIZED(widget) && weather_has_window)
+#endif
     {
       gdk_window_move_resize(widget->window, 
                              allocation->x, 
@@ -1281,8 +1285,8 @@ gtk_weather_run_preferences_dialog(GtkWidget * widget)
   gtk_box_pack_start(GTK_BOX(auto_hbox), priv->preferences_data.auto_spin_button, FALSE, FALSE, 1);
   gtk_box_pack_start(GTK_BOX(auto_hbox), auto_min_label, FALSE, FALSE, 1);
 
-  gtk_box_pack_start_defaults(GTK_BOX(update_vbox), priv->preferences_data.manual_button);
-  gtk_box_pack_start_defaults(GTK_BOX(update_vbox), auto_hbox);
+  gtk_box_pack_start(GTK_BOX(update_vbox), priv->preferences_data.manual_button, TRUE, TRUE, 0);
+  gtk_box_pack_start(GTK_BOX(update_vbox), auto_hbox, TRUE, TRUE, 0);
 
   GtkWidget * source_label = gtk_label_new(_("Source:"));
 
@@ -1321,14 +1325,14 @@ gtk_weather_run_preferences_dialog(GtkWidget * widget)
   gtk_container_add(GTK_CONTAINER(forecast_frame), forecast_table);
 
   /* VBox packing starts here */
-  gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(priv->preferences_data.dialog)->vbox), 
-                              location_frame);
+  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(priv->preferences_data.dialog)->vbox),
+                     location_frame, TRUE, TRUE, 0);
 
-  gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(priv->preferences_data.dialog)->vbox),
-                              display_frame);
+  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(priv->preferences_data.dialog)->vbox),
+                     display_frame, TRUE, TRUE, 0);
 
-  gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(priv->preferences_data.dialog)->vbox),
-                              forecast_frame);
+  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(priv->preferences_data.dialog)->vbox),
+                     forecast_frame, TRUE, TRUE, 0);
 
   /* Dialog is shown inside */
   gtk_weather_update_preferences_dialog(weather);
@@ -1902,7 +1906,7 @@ gtk_weather_show_location_progress_bar(GtkWeather * weather)
 
   gtk_container_add(GTK_CONTAINER(alignment), progress_bar);
 
-  gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), alignment);
+  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), alignment, TRUE, TRUE, 0);
 
   int timer = g_timeout_add(500, gtk_weather_update_location_progress_bar, &priv->location_data);
 
@@ -2088,7 +2092,7 @@ gtk_weather_show_location_list(GtkWeather * weather, GList * list)
 
   gtk_container_add(GTK_CONTAINER(scrolled_window), treeview);
 
-  gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), scrolled_window);
+  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), scrolled_window, TRUE, TRUE, 0);
 
   gtk_widget_show_all(dialog);
 
index 7388ea2..ecc0259 100644 (file)
@@ -63,6 +63,7 @@ static void wincmd_execute(WinCmdPlugin * wc, WindowCommand command)
     /* Get the list of all windows. */
     int client_count;
     Window * client_list = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST, XA_WINDOW, &client_count);
+    Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
     if (client_list != NULL)
     {
         /* Loop over all windows. */
@@ -87,9 +88,9 @@ static void wincmd_execute(WinCmdPlugin * wc, WindowCommand command)
 
                     case WC_ICONIFY:
                         if (( ! wc->toggle_preference) || ( ! wc->toggle_state))
-                            XIconifyWindow(GDK_DISPLAY(), client_list[i], DefaultScreen(GDK_DISPLAY()));
+                            XIconifyWindow(xdisplay, client_list[i], DefaultScreen(xdisplay));
                         else
-                            XMapWindow (GDK_DISPLAY(), client_list[i]);
+                            XMapWindow (xdisplay, client_list[i]);
                         break;
 
                     case WC_SHADE:
@@ -131,7 +132,8 @@ static gboolean wincmd_button_clicked(GtkWidget * widget, GdkEventButton * event
         if (gdk_x11_screen_supports_net_wm_hint(screen, atom))
         {
             int showing_desktop = ((( ! wc->toggle_preference) || ( ! wc->toggle_state)) ? 1 : 0);
-            Xclimsg(DefaultRootWindow(GDK_DISPLAY()), a_NET_SHOWING_DESKTOP, showing_desktop, 0, 0, 0, 0);
+            Xclimsg(DefaultRootWindow(GDK_DISPLAY_XDISPLAY(gdk_display_get_default())),
+                    a_NET_SHOWING_DESKTOP, showing_desktop, 0, 0, 0, 0);
             wincmd_adjust_toggle_state(wc);
         }
         else
index d91ce67..e675cff 100644 (file)
@@ -112,7 +112,7 @@ static void refresh_group_xkb(XkbPlugin * xkb)
     /* Get the current group number.
      * This shouldn't be necessary, but mask the group number down for safety. */
     XkbStateRec xkb_state;
-    XkbGetState(GDK_DISPLAY(), XkbUseCoreKbd, &xkb_state);
+    XkbGetState(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbUseCoreKbd, &xkb_state);
     xkb->current_group_xkb_no = xkb_state.group & (XkbNumKbdGroups - 1);
 }
 
@@ -126,8 +126,9 @@ static int initialize_keyboard_description(XkbPlugin * xkb)
     else
     {
         /* Read necessary values into the keyboard description. */
-        XkbGetControls(GDK_DISPLAY(), XkbAllControlsMask, xkb_desc);
-        XkbGetNames(GDK_DISPLAY(), XkbSymbolsNameMask | XkbGroupNamesMask, xkb_desc);
+        Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+        XkbGetControls(xdisplay, XkbAllControlsMask, xkb_desc);
+        XkbGetNames(xdisplay, XkbSymbolsNameMask | XkbGroupNamesMask, xkb_desc);
         if ((xkb_desc->names == NULL) || (xkb_desc->ctrls == NULL) || (xkb_desc->names->groups == NULL))
             g_warning("XkbGetControls/XkbGetNames failed\n");
         else
@@ -142,7 +143,7 @@ static int initialize_keyboard_description(XkbPlugin * xkb)
                 if (group_source[i] != None)
                 {
                     xkb->group_count = i + 1;
-                    char * p = XGetAtomName(GDK_DISPLAY(), group_source[i]);
+                    char * p = XGetAtomName(xdisplay, group_source[i]);
                     xkb->group_names[i] = g_strdup(p);
                     XFree(p);
                 }
@@ -159,7 +160,7 @@ static int initialize_keyboard_description(XkbPlugin * xkb)
              * This is a plus-sign separated string. */
             if (xkb_desc->names->symbols != None)
             {
-                char * symbol_string = XGetAtomName(GDK_DISPLAY(), xkb_desc->names->symbols);
+                char * symbol_string = XGetAtomName(xdisplay, xkb_desc->names->symbols);
                 if (symbol_string != NULL)
                 {
                     char * p = symbol_string;
@@ -289,8 +290,11 @@ void xkb_mechanism_constructor(XkbPlugin * xkb)
     int maj = XkbMajorVersion;
     int min = XkbMinorVersion;
     if ((XkbLibraryVersion(&maj, &min))
-    && (XkbQueryExtension(GDK_DISPLAY(), &opcode, &xkb->base_event_code, &xkb->base_error_code, &maj, &min)))
+    && (XkbQueryExtension(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
+                          &opcode, &xkb->base_event_code, &xkb->base_error_code, &maj, &min)))
     {
+        Display *xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+
         /* Read the keyboard description. */
         initialize_keyboard_description(xkb);
 
@@ -298,8 +302,8 @@ void xkb_mechanism_constructor(XkbPlugin * xkb)
         gdk_window_add_filter(NULL, (GdkFilterFunc) xkb_event_filter, (gpointer) xkb);
 
         /* Specify events we will receive. */
-        XkbSelectEvents(GDK_DISPLAY(), XkbUseCoreKbd, XkbNewKeyboardNotifyMask, XkbNewKeyboardNotifyMask);
-        XkbSelectEventDetails(GDK_DISPLAY(), XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
+        XkbSelectEvents(xdisplay, XkbUseCoreKbd, XkbNewKeyboardNotifyMask, XkbNewKeyboardNotifyMask);
+        XkbSelectEventDetails(xdisplay, XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
 
         /* Get current state. */
         refresh_group_xkb(xkb);
@@ -342,7 +346,7 @@ int xkb_change_group(XkbPlugin * xkb, int increment)
     if (next_group >= xkb->group_count) next_group = 0;
 
     /* Execute the change. */
-    XkbLockGroup(GDK_DISPLAY(), XkbUseCoreKbd, next_group);
+    XkbLockGroup(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbUseCoreKbd, next_group);
     refresh_group_xkb(xkb);
     xkb_redraw(xkb);
     xkb_enter_locale_by_process(xkb);
@@ -360,7 +364,8 @@ void xkb_active_window_changed(XkbPlugin * xkb, Window window)
 
     if (new_group_xkb_no < xkb->group_count)
     {
-        XkbLockGroup(GDK_DISPLAY(), XkbUseCoreKbd, new_group_xkb_no);
+        XkbLockGroup(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
+                     XkbUseCoreKbd, new_group_xkb_no);
         refresh_group_xkb(xkb);
     }
 }