Revision: 6955
Author: nogu.dev
Date: Sun Feb 13 07:02:04 2011
Log: * helper/toolbar-standalone-gtk.c
  - (handle_draw_cb): New function.
  - (handle_expose_event_cb): Remove codes for GTK+3.
  - (main): Call handle_draw_cb() in GTK+3.
http://code.google.com/p/uim/source/detail?r=6955

Modified:
 /trunk/helper/toolbar-standalone-gtk.c

=======================================
--- /trunk/helper/toolbar-standalone-gtk.c      Fri Feb 11 19:07:35 2011
+++ /trunk/helper/toolbar-standalone-gtk.c      Sun Feb 13 07:02:04 2011
@@ -180,6 +180,26 @@

   return FALSE;
 }
+
+#if GTK_CHECK_VERSION(2, 90, 0)
+
+static gboolean
+handle_draw_cb(GtkWidget *widget, cairo_t *cr)
+{
+  GdkRectangle rect;
+  GtkAllocation allocation;
+
+  if (gdk_cairo_get_clip_rectangle(cr, &rect))
+    return FALSE;
+
+  gtk_widget_get_allocation(widget, &allocation);
+  gtk_render_handle(gtk_widget_get_style_context(widget), cr,
+                  allocation.x, allocation.y,
+                  allocation.width, allocation.height);
+  return FALSE;
+}
+
+#else

 static gboolean
 handle_expose_event_cb(GtkWidget *widget, GdkEventExpose *event)
@@ -189,19 +209,12 @@
 #if GTK_CHECK_VERSION(2, 18, 0)
   GtkAllocation allocation;
   gtk_widget_get_allocation(widget, &allocation);
-# if GTK_CHECK_VERSION(2, 90, 0)
-  gtk_render_handle(gtk_widget_get_style_context(widget),
-                  gtk_widget_get_window(widget),
-                  allocation.x, allocation.y,
-                  allocation.width, allocation.height);
-# else
gtk_paint_handle(gtk_widget_get_style(widget), gtk_widget_get_window(widget),
                   GTK_STATE_NORMAL, GTK_SHADOW_OUT,
                   rect, widget, "handlebox",
                   allocation.x, allocation.y,
                   allocation.width, allocation.height,
                   GTK_ORIENTATION_VERTICAL);
-# endif
 #else
   gtk_paint_handle(widget->style, widget->window,
                    GTK_STATE_NORMAL, GTK_SHADOW_OUT,
@@ -213,6 +226,8 @@

   return FALSE;
 }
+
+#endif

 static void
size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data)
@@ -289,8 +304,13 @@
   toolbar = (GtkWidget*)uim_toolbar_standalone_new();
   gtk_box_pack_start(GTK_BOX(hbox), toolbar, FALSE, FALSE, 0);

+#if GTK_CHECK_VERSION(2, 90, 0)
+  g_signal_connect(G_OBJECT(handle), "draw",
+                  G_CALLBACK(handle_draw_cb), NULL);
+#else
   g_signal_connect(G_OBJECT(handle), "expose-event",
                   G_CALLBACK(handle_expose_event_cb), NULL);
+#endif

   g_signal_connect(G_OBJECT(window), "delete_event",
                   G_CALLBACK(delete_event), NULL);

Reply via email to