[Xfce4-commits] <libxfce4ui:stephan/gtk3> Port libxfce4ui to gtk-3

Stephan Arts noreply at xfce.org
Fri May 4 20:36:02 CEST 2012


Updating branch refs/heads/stephan/gtk3
         to b652daa33f929f14ba2a807ab5847ef72cbaf70e (commit)
       from 75f88966cd05b0c1427bbed43f84abc07386bbfa (commit)

commit b652daa33f929f14ba2a807ab5847ef72cbaf70e
Author: Stephan Arts <stephan at xfce.org>
Date:   Fri May 4 20:33:24 2012 +0200

    Port libxfce4ui to gtk-3

 configure.ac.in                                    |   26 ++--
 glade/Makefile.am                                  |    2 +-
 libxfce4kbd-private/Makefile.am                    |   12 +-
 ...private-2.pc.in => libxfce4kbd-private-3.pc.in} |    2 +-
 libxfce4kbd-private/xfce-shortcut-dialog.c         |    5 +-
 libxfce4kbd-private/xfce-shortcuts-grabber.c       |    6 +-
 libxfce4ui/Makefile.am                             |   12 +-
 .../{libxfce4ui-1.pc.in => libxfce4ui-2.pc.in}     |    2 +-
 libxfce4ui/xfce-heading.c                          |  168 ++++++++++++++------
 libxfce4ui/xfce-sm-client.c                        |    7 +-
 libxfce4ui/xfce-spawn.c                            |    8 +-
 libxfce4ui/xfce-titled-dialog.c                    |   25 ++-
 12 files changed, 178 insertions(+), 97 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 414bcdb..240fe0d 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -7,9 +7,9 @@ dnl ***************************
 dnl *** Version information ***
 dnl ***************************
 m4_define([libxfce4ui_verinfo], [0:0:0])
-m4_define([libxfce4ui_version_api], [1])
+m4_define([libxfce4ui_version_api], [2])
 m4_define([libxfce4ui_version_major], [4])
-m4_define([libxfce4ui_version_minor], [10])
+m4_define([libxfce4ui_version_minor], [11])
 m4_define([libxfce4ui_version_micro], [0])
 m4_define([libxfce4ui_version_nano], []) dnl leave this empty to have no nano version
 m4_define([libxfce4ui_version_build], [@REVISION@])
@@ -17,7 +17,7 @@ m4_define([libxfce4ui_version_tag], [git])
 m4_define([libxfce4ui_version], [libxfce4ui_version_major().libxfce4ui_version_minor().libxfce4ui_version_micro()ifelse(libxfce4ui_version_nano(), [], [], [.libxfce4ui_version_nano()])ifelse(libxfce4ui_version_tag(), [git], [libxfce4ui_version_tag()-libxfce4ui_version_build()], [libxfce4ui_version_tag()])])
 
 m4_define([libxfce4kbd_private_verinfo], [0:0:0])
-m4_define([libxfce4kbd_private_version_api], [2])
+m4_define([libxfce4kbd_private_version_api], [3])
 
 dnl # DO NOT MODIFY ANYTHING BELOW THIS LINE, UNLESS YOU KNOW WHAT
 dnl # YOU ARE DOING.
@@ -125,9 +125,9 @@ XDT_CHECK_LIBSM()
 dnl ***********************************
 dnl *** Check for required packages ***
 dnl ***********************************
-XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.24.0])
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.20.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.9.0])
+XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.30.0])
+XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.2.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.10.0])
 
 dnl *************************************************
 dnl *** Optional support for startup notification ***
@@ -145,7 +145,7 @@ AC_ARG_ENABLE([keyboard-library],
                               [Do not compile the keyboard library needed by xfwm4 and xfce4-settings (default=enabled)])],
               [enable_keyboard_library=$enableval], [enable_keyboard_library=yes])
 if test "x$enable_keyboard_library" = "xyes"; then
-  XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.8.0])
+  XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.10.0])
 fi
 AM_CONDITIONAL([ENABLE_KEYBOARD_LIBRARY], [test "x$enable_keyboard_library" = "xyes"])
 
@@ -177,7 +177,7 @@ AC_MSG_RESULT([$with_manual_website])
 dnl *********************************************************
 dnl *** Optional support for the Glade Interface Designer ***
 dnl *********************************************************
-XDT_CHECK_OPTIONAL_PACKAGE([GLADEUI], [gladeui-1.0],
+XDT_CHECK_OPTIONAL_PACKAGE([GLADEUI], [gladeui-2.0],
                            [3.5.0], [gladeui], [glade interface designer])
 AC_ARG_WITH([gladeui-catalogdir],
             [AC_HELP_STRING([--with-gladeui-catalogdir=PATH],
@@ -193,17 +193,17 @@ AC_ARG_WITH([gladeui-pixmapdir],
             [gladeui_pixmapdir="$withval"])
 if test x"$GLADEUI_FOUND" = x"yes"; then
   if test x"$gladeui_catalogdir" = x""; then
-    GLADEUI_CATALOGDIR=`$PKG_CONFIG "--variable=catalogdir" "gladeui-1.0"`
+    GLADEUI_CATALOGDIR=`$PKG_CONFIG "--variable=catalogdir" "gladeui-2.0"`
   else
     GLADEUI_CATALOGDIR="$gladeui_catalogdir"
   fi
   if test x"$gladeui_moduledir" = x""; then
-    GLADEUI_MODULEDIR=`$PKG_CONFIG "--variable=moduledir" "gladeui-1.0"`
+    GLADEUI_MODULEDIR=`$PKG_CONFIG "--variable=moduledir" "gladeui-2.0"`
   else
     GLADEUI_MODULEDIR="$gladeui_moduledir"
   fi
   if test x"$gladeui_pixmapdir" = x""; then
-    GLADEUI_PIXMAPDIR=`$PKG_CONFIG "--variable=pixmapdir" "gladeui-1.0"`
+    GLADEUI_PIXMAPDIR=`$PKG_CONFIG "--variable=pixmapdir" "gladeui-2.0"`
   else
     GLADEUI_PIXMAPDIR="$gladeui_pixmapdir"
   fi
@@ -298,9 +298,9 @@ glade/icons/16x16/Makefile
 glade/icons/22x22/Makefile
 icons/Makefile
 icons/48x48/Makefile
-libxfce4kbd-private/libxfce4kbd-private-2.pc
+libxfce4kbd-private/libxfce4kbd-private-3.pc
 libxfce4kbd-private/Makefile
-libxfce4ui/libxfce4ui-1.pc
+libxfce4ui/libxfce4ui-2.pc
 libxfce4ui/libxfce4ui-config.h
 libxfce4ui/Makefile
 xfce4-about/Makefile
diff --git a/glade/Makefile.am b/glade/Makefile.am
index b19e357..784ef0f 100644
--- a/glade/Makefile.am
+++ b/glade/Makefile.am
@@ -33,7 +33,7 @@ libxfce4uiglade_la_LDFLAGS = \
 	$(PLATFORM_LDFLAGS)
 
 libxfce4uiglade_la_LIBADD = \
-	$(top_builddir)/libxfce4ui/libxfce4ui-1.la \
+	$(top_builddir)/libxfce4ui/libxfce4ui-2.la \
 	$(LIBXFCE4UTIL_LIBS) \
 	$(GLADEUI_LIBS)
 
diff --git a/libxfce4kbd-private/Makefile.am b/libxfce4kbd-private/Makefile.am
index abff01e..146861e 100644
--- a/libxfce4kbd-private/Makefile.am
+++ b/libxfce4kbd-private/Makefile.am
@@ -11,7 +11,7 @@ INCLUDES = \
 	-DPREFIX=\"$(prefix)\" \
 	$(PLATFORM_CPPFLAGS)
 
-lib_LTLIBRARIES = libxfce4kbd-private-2.la
+lib_LTLIBRARIES = libxfce4kbd-private-3.la
 
 libxfce4kbd_headers = \
 	xfce-shortcuts-provider.h \
@@ -29,7 +29,7 @@ libxfce4kbd_private_includedir = \
 libxfce4kbd_private_include_HEADERS = \
 	$(libxfce4kbd_headers)
 
-libxfce4kbd_private_2_la_SOURCES = \
+libxfce4kbd_private_3_la_SOURCES = \
 	$(libxfce4kbd_headers) \
 	$(libxfce4kbd_built_sources) \
 	xfce-shortcuts-provider.c \
@@ -37,7 +37,7 @@ libxfce4kbd_private_2_la_SOURCES = \
 	xfce-shortcut-dialog.c \
 	xfce-shortcuts.c
 
-libxfce4kbd_private_2_la_CFLAGS = \
+libxfce4kbd_private_3_la_CFLAGS = \
 	$(PLATFORM_CFLAGS) \
 	$(GLIB_CFLAGS)  \
 	$(GTK_CFLAGS) \
@@ -45,7 +45,7 @@ libxfce4kbd_private_2_la_CFLAGS = \
 	$(LIBXFCE4UTIL_CFLAGS) \
 	$(XFCONF_CFLAGS)
 
-libxfce4kbd_private_2_la_LDFLAGS = \
+libxfce4kbd_private_3_la_LDFLAGS = \
 	-export-dynamic \
 	-version-info $(LIBXFCE4KBD_PRIVATE_VERINFO) \
 	-export-symbols-regex "^[^_].*" \
@@ -53,7 +53,7 @@ libxfce4kbd_private_2_la_LDFLAGS = \
 	$(LIBX11_LDFLAGS) \
 	$(PLATFORM_LDFLAGS)
 
-libxfce4kbd_private_2_la_LIBADD = \
+libxfce4kbd_private_3_la_LIBADD = \
 	$(top_builddir)/libxfce4ui/libxfce4ui-$(LIBXFCE4UI_VERSION_API).la \
 	$(GLIB_LIBS) \
 	$(GTK_LIBS) \
@@ -65,7 +65,7 @@ settingsdir = $(sysconfdir)/xdg/xfce4/xfconf/xfce-perchannel-xml
 settings_DATA = xfce4-keyboard-shortcuts.xml
 
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libxfce4kbd-private-2.pc
+pkgconfig_DATA = libxfce4kbd-private-3.pc
 
 if MAINTAINER_MODE
 xfce-shortcuts-marshal.h: xfce-shortcuts-marshal.list Makefile
diff --git a/libxfce4kbd-private/libxfce4kbd-private-2.pc.in b/libxfce4kbd-private/libxfce4kbd-private-3.pc.in
similarity index 85%
rename from libxfce4kbd-private/libxfce4kbd-private-2.pc.in
rename to libxfce4kbd-private/libxfce4kbd-private-3.pc.in
index b813376..a9be23c 100644
--- a/libxfce4kbd-private/libxfce4kbd-private-2.pc.in
+++ b/libxfce4kbd-private/libxfce4kbd-private-3.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
 
 Name: libxfce4kbd-private
 Description: Private Xfce library for shared code between xfwm4 and xfce4-settings
-Requires: gdk-2.0 gtk+-2.0 libxfce4util-1.0 libxfconf-0 libxfce4ui-1
+Requires: gdk-3.0 gtk+-3.0 libxfce4util-1.0 libxfconf-0 libxfce4ui-2
 Version: @PACKAGE_VERSION@
 Libs: @LIBX11_LDFLAGS@ -L${libdir} -lxfce4kbd-private- at LIBXFCE4KBD_PRIVATE_VERSION_API@
 Cflags: @LIBX11_CFLAGS@ -I${includedir}/xfce4/libxfce4kbd-private- at LIBXFCE4KBD_PRIVATE_VERSION_API@
diff --git a/libxfce4kbd-private/xfce-shortcut-dialog.c b/libxfce4kbd-private/xfce-shortcut-dialog.c
index 5f1b058..d7c1d59 100644
--- a/libxfce4kbd-private/xfce-shortcut-dialog.c
+++ b/libxfce4kbd-private/xfce-shortcut-dialog.c
@@ -219,9 +219,6 @@ xfce_shortcut_dialog_create_contents (XfceShortcutDialog *dialog,
   gtk_window_set_title (GTK_WINDOW (dialog), title);
   gtk_window_set_icon_name (GTK_WINDOW (dialog), "input-keyboard");
 
-  /* Configure dialog */
-  gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-
   /* Create clear button for xfwm4 */
   if (g_utf8_collate (provider, "xfwm4") == 0)
     {
@@ -239,7 +236,7 @@ xfce_shortcut_dialog_create_contents (XfceShortcutDialog *dialog,
   gtk_table_set_row_spacings (GTK_TABLE (table), 6);
   gtk_table_set_col_spacings (GTK_TABLE (table), 12);
   gtk_container_set_border_width (GTK_CONTAINER (table), 12);
-  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table);
+  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), table);
   gtk_widget_show (table);
 
   label = gtk_label_new (action_label);
diff --git a/libxfce4kbd-private/xfce-shortcuts-grabber.c b/libxfce4kbd-private/xfce-shortcuts-grabber.c
index 9faec07..7c0b432 100644
--- a/libxfce4kbd-private/xfce-shortcuts-grabber.c
+++ b/libxfce4kbd-private/xfce-shortcuts-grabber.c
@@ -368,7 +368,6 @@ xfce_shortcuts_grabber_grab (XfceShortcutsGrabber *grabber,
       for (j = 0; j < screens; j++)
         {
           /* Do the grab on all screens */
-          GdkScreen *screen;
           Window     root_window;
 
           /* Ignorable modifiers */
@@ -384,8 +383,7 @@ xfce_shortcuts_grabber_grab (XfceShortcutsGrabber *grabber,
           };
 
           /* Retrieve the root window of the screen */
-          screen = gdk_display_get_screen (display, j);
-          root_window = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen));
+          root_window = gdk_x11_get_default_root_xwindow ();
 
           gdk_error_trap_push ();
 
@@ -530,7 +528,7 @@ xfce_shortcuts_grabber_event_filter (GdkXEvent            *gdk_xevent,
                            context.result, timestamp);
 
   gdk_flush ();
-  gdk_error_trap_pop ();
+  gdk_error_trap_pop_ignored ();
 
   return GDK_FILTER_CONTINUE;
 }
diff --git a/libxfce4ui/Makefile.am b/libxfce4ui/Makefile.am
index 0c3b8f9..2bbdc3f 100644
--- a/libxfce4ui/Makefile.am
+++ b/libxfce4ui/Makefile.am
@@ -11,7 +11,7 @@ INCLUDES = \
 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
 	$(PLATFORM_CPPFLAGS)
 
-lib_LTLIBRARIES = libxfce4ui-1.la
+lib_LTLIBRARIES = libxfce4ui-2.la
 
 libxfce4ui_enum_headers = \
 	xfce-sm-client.h
@@ -41,7 +41,7 @@ libxfce4ui_includedir = \
 libxfce4ui_include_HEADERS = \
 	$(libxfce4ui_headers)
 
-libxfce4ui_1_la_SOURCES = \
+libxfce4ui_2_la_SOURCES = \
 	$(libxfce4ui_headers) \
 	$(libxfce4ui_built_sources) \
 	libxfce4ui-config.c \
@@ -55,28 +55,28 @@ libxfce4ui_1_la_SOURCES = \
 	xfce-spawn.c \
 	xfce-titled-dialog.c
 
-libxfce4ui_1_la_CFLAGS = \
+libxfce4ui_2_la_CFLAGS = \
 	$(LIBSM_CFLAGS) \
 	$(GTK_CFLAGS) \
 	$(LIBSTARTUP_NOTIFICATION_CFLAGS) \
 	$(LIBXFCE4UTIL_CFLAGS) \
 	$(PLATFORM_CFLAGS)
 
-libxfce4ui_1_la_LDFLAGS = \
+libxfce4ui_2_la_LDFLAGS = \
 	-version-info $(LIBXFCE4UI_VERINFO) \
 	-export-symbols-regex "^[^_].*" \
 	-no-undefined \
 	$(LIBSM_LDFLAGS) \
 	$(PLATFORM_LDFLAGS)
 
-libxfce4ui_1_la_LIBADD = \
+libxfce4ui_2_la_LIBADD = \
 	$(LIBSM_LIBS) \
 	$(GTK_LIBS) \
 	$(LIBSTARTUP_NOTIFICATION_LIBS) \
 	$(LIBXFCE4UTIL_LIBS)
 
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libxfce4ui-1.pc
+pkgconfig_DATA = libxfce4ui-2.pc
 
 
 ##
diff --git a/libxfce4ui/libxfce4ui-1.pc.in b/libxfce4ui/libxfce4ui-2.pc.in
similarity index 91%
rename from libxfce4ui/libxfce4ui-1.pc.in
rename to libxfce4ui/libxfce4ui-2.pc.in
index cb6a507..4061dcf 100644
--- a/libxfce4ui/libxfce4ui-1.pc.in
+++ b/libxfce4ui/libxfce4ui-2.pc.in
@@ -9,7 +9,7 @@ glade_moduledir=@GLADEUI_PIXMAPDIR@
 
 Name: libxfce4ui
 Description: Widgets library for Xfce
-Requires: gtk+-2.0 libxfce4util-1.0
+Requires: gtk+-3.0 libxfce4util-1.0
 Version: @PACKAGE_VERSION@
 Libs: -L${libdir} -lxfce4ui- at LIBXFCE4UI_VERSION_API@
 Cflags: -I${includedir}/xfce4/libxfce4ui- at LIBXFCE4UI_VERSION_API@
diff --git a/libxfce4ui/xfce-heading.c b/libxfce4ui/xfce-heading.c
index 064becc..5accff3 100644
--- a/libxfce4ui/xfce-heading.c
+++ b/libxfce4ui/xfce-heading.c
@@ -43,14 +43,20 @@ static void         _xfce_heading_finalize       (GObject          *object);
 static void         _xfce_heading_realize        (GtkWidget        *widget);
 static void         _xfce_heading_size_request   (GtkWidget        *widget,
                                                   GtkRequisition   *requisition);
-static void         _xfce_heading_style_set      (GtkWidget        *widget,
-                                                  GtkStyle         *previous_style);
-static gboolean     _xfce_heading_expose_event   (GtkWidget        *widget,
-                                                  GdkEventExpose   *event);
+static void         _xfce_heading_style_updated  (GtkWidget        *widget);
+static gboolean     _xfce_heading_draw           (GtkWidget        *widget,
+                                                  cairo_t *ctx);
 static AtkObject   *_xfce_heading_get_accessible (GtkWidget        *widget);
-static PangoLayout *_xfce_heading_make_layout    (XfceHeading      *heading);
+static PangoLayout *_xfce_heading_make_layout    (XfceHeading *heading);
 static GdkPixbuf   *_xfce_heading_make_pixbuf    (XfceHeading      *heading);
 
+static void         _xfce_heading_get_preferred_width  (GtkWidget *widget,
+                                                        gint *min,
+                                                        gint *natural);
+static void         _xfce_heading_get_preferred_height (GtkWidget *widget,
+                                                        gint *min,
+                                                        gint *natural);
+
 
 
 struct _XfceHeadingClass
@@ -62,12 +68,13 @@ struct _XfceHeadingClass
 struct _XfceHeading
 {
   /*< private >*/
-  GtkWidget  __parent__;
+  GtkWidget       __parent__;
 
-  GdkPixbuf *icon;
-  gchar     *icon_name;
-  gchar     *subtitle;
-  gchar     *title;
+  GtkStyleContext *context;
+  GdkPixbuf       *icon;
+  gchar           *icon_name;
+  gchar           *subtitle;
+  gchar           *title;
 };
 
 
@@ -87,9 +94,10 @@ _xfce_heading_class_init (XfceHeadingClass *klass)
 
   gtkwidget_class = GTK_WIDGET_CLASS (klass);
   gtkwidget_class->realize = _xfce_heading_realize;
-  gtkwidget_class->size_request = _xfce_heading_size_request;
-  gtkwidget_class->style_set = _xfce_heading_style_set;
-  gtkwidget_class->expose_event = _xfce_heading_expose_event;
+  gtkwidget_class->get_preferred_width = _xfce_heading_get_preferred_width;
+  gtkwidget_class->get_preferred_height = _xfce_heading_get_preferred_height;
+  gtkwidget_class->style_updated = _xfce_heading_style_updated;
+  gtkwidget_class->draw = _xfce_heading_draw;
   gtkwidget_class->get_accessible = _xfce_heading_get_accessible;
 }
 
@@ -98,8 +106,14 @@ _xfce_heading_class_init (XfceHeadingClass *klass)
 static void
 _xfce_heading_init (XfceHeading *heading)
 {
+  GtkStyleContext  *style_context = NULL;
+
   /* setup the widget parameters */
-  GTK_WIDGET_UNSET_FLAGS (heading, GTK_NO_WINDOW);
+  gtk_widget_set_has_window (GTK_WIDGET (heading), TRUE);
+
+  style_context = gtk_widget_get_style_context (GTK_WIDGET (heading));
+
+  gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_HEADER);
 }
 
 
@@ -125,36 +139,63 @@ _xfce_heading_finalize (GObject *object)
 static void
 _xfce_heading_realize (GtkWidget *widget)
 {
-  GdkWindowAttr attributes;
+  GdkWindowAttr     attributes;
+  GtkAllocation     allocation;
+  GdkWindow        *window;
+  XfceHeading      *heading = XFCE_HEADING (widget);
 
   /* mark the widget as realized */
-  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+  gtk_widget_set_realized (widget, TRUE);
+  gtk_widget_get_allocation (widget, &allocation);
 
   /* setup the window attributes */
-  attributes.x = widget->allocation.x;
-  attributes.y = widget->allocation.y;
-  attributes.width = widget->allocation.width;
-  attributes.height = widget->allocation.height;
+  attributes.x = allocation.x;
+  attributes.y = allocation.y;
+  attributes.width = allocation.width;
+  attributes.height = allocation.height;
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.visual = gtk_widget_get_visual (widget);
-  attributes.colormap = gtk_widget_get_colormap (widget);
   attributes.event_mask = gtk_widget_get_events (widget)
                         | GDK_EXPOSURE_MASK;
 
   /* allocate the widget window */
-  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
-                                   GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
-  gdk_window_set_user_data (widget->window, widget);
+  window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
+                                   GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL);
+  gtk_widget_set_window (widget, window);
+  gdk_window_set_user_data (window, widget);
+
+  heading->context = gtk_widget_get_style_context (widget);
+}
 
-  /* connect the style to the window */
-  widget->style = gtk_style_attach (widget->style, widget->window);
 
-  /* set background color (using the base color) */
-  gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
+
+static void
+_xfce_heading_get_preferred_width (
+        GtkWidget *widget,
+        gint *min,
+        gint *natural)
+{
+  GtkRequisition requisition;
+  
+  _xfce_heading_size_request (widget, &requisition);
+
+  *min = *natural = requisition.width;
 }
 
+static void
+_xfce_heading_get_preferred_height (
+        GtkWidget *widget,
+        gint *min,
+        gint *natural)
+{
+
+  GtkRequisition requisition;
+  
+  _xfce_heading_size_request (widget, &requisition);
 
+  *min = *natural = requisition.height;
+}
 
 static void
 _xfce_heading_size_request (GtkWidget      *widget,
@@ -194,37 +235,62 @@ _xfce_heading_size_request (GtkWidget      *widget,
 
 
 static void
-_xfce_heading_style_set (GtkWidget *widget,
-                         GtkStyle  *previous_style)
+_xfce_heading_style_updated (GtkWidget *widget)
 {
+  GtkStyleContext  *style_context = NULL;
+
   /* check if we're already realized */
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized(widget))
     {
-      /* set background color (using the base color) */
-      gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
+      style_context = gtk_widget_get_style_context (widget);
+
+
+      gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_HEADER);
     }
 }
 
 
 
 static gboolean
-_xfce_heading_expose_event (GtkWidget      *widget,
-                            GdkEventExpose *event)
+_xfce_heading_draw (GtkWidget      *widget,
+                    cairo_t *ctx)
 {
   XfceHeading *heading = XFCE_HEADING (widget);
   PangoLayout *layout;
+  GdkRGBA      bg_color;
+  GdkRGBA      text_color;
   GdkPixbuf   *pixbuf;
   gboolean     rtl;
   gint         width;
   gint         height;
   gint         x;
   gint         y;
+  GtkAllocation allocation;
+
+  gtk_style_context_get_background_color (heading->context,
+                                          GTK_STATE_FLAG_NORMAL,
+                                          &bg_color);
+  gtk_style_context_get_color (heading->context,
+                               GTK_STATE_FLAG_NORMAL,
+                               &text_color);
+  
+  gtk_widget_get_allocation (widget, &allocation);
 
   /* check if we should render from right to left */
   rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
 
   /* determine the initial horizontal position */
-  x = (rtl ? widget->allocation.width - XFCE_HEADING_BORDER : XFCE_HEADING_BORDER);
+  x = (rtl ? allocation.width - XFCE_HEADING_BORDER : XFCE_HEADING_BORDER);
+
+  gdk_cairo_set_source_rgba (ctx, &bg_color);
+
+  cairo_rectangle (
+        ctx,
+        0.0, 0.0,
+        allocation.width, allocation.height);
+  cairo_paint (ctx);
+
+  cairo_save (ctx);
 
   /* check if we have a pixbuf to render */
   pixbuf = _xfce_heading_make_pixbuf (heading);
@@ -235,12 +301,17 @@ _xfce_heading_expose_event (GtkWidget      *widget,
       height = gdk_pixbuf_get_height (pixbuf);
 
       /* determine the vertical position */
-      y = (widget->allocation.height - height) / 2;
+      y = (allocation.height - height) / 2;
 
-      /* render the pixbuf */
-      gdk_draw_pixbuf (widget->window, widget->style->black_gc, pixbuf, 0, 0,
-                       (rtl ? x - width : x), y, width, height,
-                       GDK_RGB_DITHER_NORMAL, 0, 0);
+      cairo_translate ( ctx,
+                        rtl ? x - width : x,
+                        y );
+
+      gdk_cairo_set_source_pixbuf (ctx,
+                                   pixbuf,
+                                   0.0,
+                                   0.0 );
+      cairo_paint ( ctx );
 
       /* release the pixbuf */
       g_object_unref (G_OBJECT (pixbuf));
@@ -248,22 +319,26 @@ _xfce_heading_expose_event (GtkWidget      *widget,
       /* advance the horizontal position */
       x += (rtl ? -1 : 1) * (width + XFCE_HEADING_SPACING);
     }
+  cairo_restore (ctx);
 
   /* generate the title layout */
   layout = _xfce_heading_make_layout (heading);
   pango_layout_get_pixel_size (layout, &width, &height);
 
   /* determine the vertical position */
-  y = (widget->allocation.height - height) / 2;
+  y = (allocation.height - height) / 2;
 
   /* render the title */
-  gtk_paint_layout (widget->style, widget->window,
-                    GTK_WIDGET_STATE (widget), TRUE, &event->area,
-                    widget, "heading", (rtl ? x - width : x), y, layout);
+  cairo_move_to ( ctx,
+                  rtl ? x - width : x,
+                  y );
+
+  pango_cairo_update_layout (ctx, layout);
+  gdk_cairo_set_source_rgba (ctx, &text_color);
+  pango_cairo_show_layout (ctx, layout);
 
   /* release the layout */
   g_object_unref (G_OBJECT (layout));
-
   return FALSE;
 }
 
@@ -311,6 +386,7 @@ _xfce_heading_make_layout (XfceHeading *heading)
 
   /* allocate and setup a new layout from the widget's context */
   layout = gtk_widget_create_pango_layout (GTK_WIDGET (heading), text->str);
+  
 
   /* allocate an attribute list (large bold title) */
   attr_list = pango_attr_list_new ();
diff --git a/libxfce4ui/xfce-sm-client.c b/libxfce4ui/xfce-sm-client.c
index c757246..509406b 100644
--- a/libxfce4ui/xfce-sm-client.c
+++ b/libxfce4ui/xfce-sm-client.c
@@ -56,7 +56,8 @@
 #include <X11/SM/SMlib.h>
 #endif
 
-#include <gdk/gdkwindow.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
 #include <libxfce4util/libxfce4util.h>
@@ -643,7 +644,7 @@ xfce_sm_client_set_client_id(XfceSMClient *sm_client,
     g_free(sm_client->client_id);
     sm_client->client_id = g_strdup(client_id);
 
-    gdk_set_sm_client_id(sm_client->client_id);
+    gdk_x11_set_sm_client_id(sm_client->client_id);
 
     g_object_notify(G_OBJECT(sm_client), "client-id");
 }
@@ -1719,7 +1720,7 @@ xfce_sm_client_disconnect(XfceSMClient *sm_client)
 
     SmcCloseConnection(sm_client->session_connection, 0, NULL);
     sm_client->session_connection = NULL;
-    gdk_set_sm_client_id(NULL);
+    gdk_x11_set_sm_client_id(NULL);
 
     xfce_sm_client_set_state(sm_client, XFCE_SM_CLIENT_STATE_DISCONNECTED);
 #endif
diff --git a/libxfce4ui/xfce-spawn.c b/libxfce4ui/xfce-spawn.c
index 2479d88..0820f2d 100644
--- a/libxfce4ui/xfce-spawn.c
+++ b/libxfce4ui/xfce-spawn.c
@@ -210,12 +210,14 @@ xfce_spawn_get_active_workspace_number (GdkScreen *screen)
   _NET_CURRENT_DESKTOP = XInternAtom (GDK_WINDOW_XDISPLAY (root), "_NET_CURRENT_DESKTOP", False);
   _WIN_WORKSPACE = XInternAtom (GDK_WINDOW_XDISPLAY (root), "_WIN_WORKSPACE", False);
 
-  if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root), GDK_WINDOW_XWINDOW (root),
+  if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root),
+                          gdk_x11_get_default_root_xwindow(),
                           _NET_CURRENT_DESKTOP, 0, 32, False, XA_CARDINAL,
                           &type_ret, &format_ret, &nitems_ret, &bytes_after_ret,
                           (gpointer) &prop_ret) != Success)
     {
-      if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root), GDK_WINDOW_XWINDOW (root),
+      if (XGetWindowProperty (GDK_WINDOW_XDISPLAY (root),
+                              gdk_x11_get_default_root_xwindow(),
                               _WIN_WORKSPACE, 0, 32, False, XA_CARDINAL,
                               &type_ret, &format_ret, &nitems_ret, &bytes_after_ret,
                               (gpointer) &prop_ret) != Success)
@@ -235,7 +237,7 @@ xfce_spawn_get_active_workspace_number (GdkScreen *screen)
       XFree (prop_ret);
     }
 
-  gdk_error_trap_pop ();
+  gdk_error_trap_pop_ignored ();
 
   return ws_num;
 }
diff --git a/libxfce4ui/xfce-titled-dialog.c b/libxfce4ui/xfce-titled-dialog.c
index 5c8939d..7a57196 100644
--- a/libxfce4ui/xfce-titled-dialog.c
+++ b/libxfce4ui/xfce-titled-dialog.c
@@ -106,8 +106,8 @@ xfce_titled_dialog_class_init (XfceTitledDialogClass *klass)
 
   /* connect additional key bindings to the GtkDialog::close action signal */
   binding_set = gtk_binding_set_by_class (klass);
-  gtk_binding_entry_add_signal (binding_set, GDK_w, GDK_CONTROL_MASK, "close", 0);
-  gtk_binding_entry_add_signal (binding_set, GDK_W, GDK_CONTROL_MASK, "close", 0);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_w, GDK_CONTROL_MASK, "close", 0);
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_W, GDK_CONTROL_MASK, "close", 0);
 }
 
 
@@ -117,13 +117,21 @@ xfce_titled_dialog_init (XfceTitledDialog *titled_dialog)
 {
   GtkWidget *line;
   GtkWidget *vbox;
+  GtkStyleContext  *style_context = NULL;
+
+  style_context = gtk_widget_get_style_context (GTK_WIDGET (titled_dialog));
+
+  gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_DEFAULT);
+
+  gtk_widget_set_has_window (GTK_WIDGET (titled_dialog), FALSE);
+
 
   /* connect the private data */
   titled_dialog->priv = XFCE_TITLED_DIALOG_GET_PRIVATE (titled_dialog);
 
   /* remove the main dialog box from the window */
-  g_object_ref (G_OBJECT (GTK_DIALOG (titled_dialog)->vbox));
-  gtk_container_remove (GTK_CONTAINER (titled_dialog), GTK_DIALOG (titled_dialog)->vbox);
+  g_object_ref (G_OBJECT (gtk_dialog_get_content_area(GTK_DIALOG (titled_dialog))));
+  gtk_container_remove (GTK_CONTAINER (titled_dialog), gtk_dialog_get_content_area (GTK_DIALOG (titled_dialog)));
 
   /* add a new vbox w/o border to the main window */
   vbox = gtk_vbox_new (FALSE, 0);
@@ -141,8 +149,8 @@ xfce_titled_dialog_init (XfceTitledDialog *titled_dialog)
   gtk_widget_show (line);
 
   /* add the main dialog box to the new vbox */
-  gtk_box_pack_start (GTK_BOX (vbox), GTK_DIALOG (titled_dialog)->vbox, TRUE, TRUE, 0);
-  g_object_unref (G_OBJECT (GTK_DIALOG (titled_dialog)->vbox));
+  gtk_box_pack_start (GTK_BOX (vbox), gtk_dialog_get_content_area(GTK_DIALOG (titled_dialog)), TRUE, TRUE, 0);
+  g_object_unref (G_OBJECT(gtk_dialog_get_content_area(GTK_DIALOG (titled_dialog))));
 
   /* make sure to update the heading whenever one of the relevant window properties changes */
   g_signal_connect (G_OBJECT (titled_dialog), "notify::icon", G_CALLBACK (xfce_titled_dialog_update_heading), NULL);
@@ -216,11 +224,11 @@ xfce_titled_dialog_close (GtkDialog *dialog)
   GdkEvent *event;
 
   /* verify that the dialog is realized */
-  if (G_LIKELY (GTK_WIDGET_REALIZED (dialog)))
+  if (G_LIKELY (gtk_widget_get_realized(GTK_WIDGET (dialog))))
     {
       /* send a delete event to the dialog */
       event = gdk_event_new (GDK_DELETE);
-      event->any.window = g_object_ref (GTK_WIDGET (dialog)->window);
+      event->any.window = g_object_ref (gtk_widget_get_window(GTK_WIDGET (dialog)));
       event->any.send_event = TRUE;
       gtk_main_do_event (event);
       gdk_event_free (event);
@@ -283,7 +291,6 @@ xfce_titled_dialog_new_with_buttons (const gchar    *title,
   /* allocate the dialog */
   dialog = g_object_new (XFCE_TYPE_TITLED_DIALOG,
                          "destroy-with-parent", ((flags & GTK_DIALOG_DESTROY_WITH_PARENT) != 0),
-                         "has-separator", ((flags & GTK_DIALOG_NO_SEPARATOR) == 0),
                          "modal", ((flags & GTK_DIALOG_MODAL) != 0),
                          "title", title,
                          NULL);


More information about the Xfce4-commits mailing list