[gtk+/touch-selection-fixes: 2/3] texthandles: set input shape on handles' window



commit ba52b1da74070791ef560ed14146f01bf7aa01f6
Author: Carlos Garnacho <carlos lanedo com>
Date:   Tue Sep 18 15:15:41 2012 +0200

    texthandles: set input shape on handles' window
    
    This is so arbitrary handle shapes can be set, and still be
    only draggable from the visible areas

 gtk/gtktexthandle.c |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index b301c20..bc9ca98 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -127,33 +127,33 @@ _gtk_text_handle_update_shape (GtkTextHandle         *handle,
                                GtkTextHandlePosition  pos)
 {
   GtkTextHandlePrivate *priv;
+  cairo_surface_t *surface;
+  cairo_region_t *region;
+  cairo_t *cr;
 
   priv = handle->priv;
 
+  surface =
+    gdk_window_create_similar_surface (window,
+                                       CAIRO_CONTENT_COLOR_ALPHA,
+                                       gdk_window_get_width (window),
+                                       gdk_window_get_height (window));
+
+  cr = cairo_create (surface);
+  _gtk_text_handle_draw (handle, cr, pos);
+  cairo_destroy (cr);
+
+  region = gdk_cairo_region_create_from_surface (surface);
+
   if (gtk_widget_is_composited (priv->parent))
     gdk_window_shape_combine_region (window, NULL, 0, 0);
   else
-    {
-      cairo_surface_t *surface;
-      cairo_region_t *region;
-      cairo_t *cr;
-
-      surface =
-        gdk_window_create_similar_surface (window,
-                                           CAIRO_CONTENT_COLOR_ALPHA,
-                                           gdk_window_get_width (window),
-                                           gdk_window_get_height (window));
+    gdk_window_shape_combine_region (window, region, 0, 0);
 
-      cr = cairo_create (surface);
-      _gtk_text_handle_draw (handle, cr, pos);
-      cairo_destroy (cr);
+  gdk_window_input_shape_combine_region (window, region, 0, 0);
 
-      region = gdk_cairo_region_create_from_surface (surface);
-      gdk_window_shape_combine_region (window, region, 0, 0);
-
-      cairo_surface_destroy (surface);
-      cairo_region_destroy (region);
-    }
+  cairo_surface_destroy (surface);
+  cairo_region_destroy (region);
 }
 
 static GdkWindow *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]