Author: olivier
Date: 2007-04-02 19:32:01 +0000 (Mon, 02 Apr 2007)
New Revision: 25371

Modified:
   xfwm4/branches/xfce_4_4/src/display.c
   xfwm4/branches/xfce_4_4/src/display.h
   xfwm4/branches/xfce_4_4/src/frame.c
Log:
Add support for shape input with XShape extension 1.1 (Bug #3092)

Modified: xfwm4/branches/xfce_4_4/src/display.c
===================================================================
--- xfwm4/branches/xfce_4_4/src/display.c       2007-04-02 19:31:29 UTC (rev 
25370)
+++ xfwm4/branches/xfce_4_4/src/display.c       2007-04-02 19:32:01 UTC (rev 
25371)
@@ -182,9 +182,7 @@
 myDisplayInit (GdkDisplay *gdisplay)
 {
     DisplayInfo *display;
-#ifdef HAVE_XSYNC
-    int xsync_major, xsync_minor;
-#endif /* HAVE_XSYNC */
+    int major, minor;
     int dummy;
 
     display = g_new0 (DisplayInfo, 1);
@@ -205,11 +203,18 @@
     }
 
     /* Test XShape extension support */
+    major = 0;
+    minor = 0;
+    display->shape_version = 0;
     if (XShapeQueryExtension (display->dpy,
                               &display->shape_event_base,
                               &dummy))
     {
         display->have_shape = TRUE;
+        if (XShapeQueryVersion (display->dpy, &major, &minor))
+        {
+            display->shape_version = major * 1000 + minor;
+        }
     }
     else
     {
@@ -224,15 +229,15 @@
     display->xsync_error_base = 0;
     display->xsync_event_base = 0;
 
-    xsync_major = SYNC_MAJOR_VERSION;
-    xsync_minor = SYNC_MINOR_VERSION;
+    major = SYNC_MAJOR_VERSION;
+    minor = SYNC_MINOR_VERSION;
     
     if (XSyncQueryExtension (display->dpy,
                               &display->xsync_event_base,
                               &display->xsync_error_base)
          && XSyncInitialize (display->dpy, 
-                             &xsync_major, 
-                             &xsync_minor))
+                             &major, 
+                             &minor))
     {
         display->have_xsync = TRUE;
     }

Modified: xfwm4/branches/xfce_4_4/src/display.h
===================================================================
--- xfwm4/branches/xfce_4_4/src/display.h       2007-04-02 19:31:29 UTC (rev 
25370)
+++ xfwm4/branches/xfce_4_4/src/display.h       2007-04-02 19:32:01 UTC (rev 
25371)
@@ -241,6 +241,7 @@
     gboolean have_render;
     gboolean have_xrandr;
     gboolean have_xsync;
+    gint shape_version;
     gint shape_event_base;
     gint dbl_click_time;
     gint xgrabcount;

Modified: xfwm4/branches/xfce_4_4/src/frame.c
===================================================================
--- xfwm4/branches/xfce_4_4/src/frame.c 2007-04-02 19:31:29 UTC (rev 25370)
+++ xfwm4/branches/xfce_4_4/src/frame.c 2007-04-02 19:32:01 UTC (rev 25371)
@@ -37,6 +37,10 @@
 #include "frame.h"
 #include "compositor.h"
 
+#ifndef ShapeInput
+#define ShapeInput 2;
+#endif
+
 int
 frameDecorationLeft (ScreenInfo *screen_info)
 {
@@ -807,6 +811,13 @@
     XShapeCombineRectangles (display_info->dpy, shape_win, ShapeBounding, 0, 
0, &rect, 1, ShapeIntersect, Unsorted);
     XShapeCombineShape (display_info->dpy, c->frame, ShapeBounding, 0, 0, 
shape_win, ShapeBounding, ShapeSet);
 
+    /* Set Input shape when using XShape extension 1.1 and later */
+    if (display_info->shape_version >= 1001)
+    {
+        XShapeCombineShape (display_info->dpy, shape_win, ShapeInput, 
frameLeft (c), frameTop (c), c->window, ShapeBounding, ShapeSubtract);
+        XShapeCombineShape (display_info->dpy, shape_win, ShapeInput, 
frameLeft (c), frameTop (c), c->window, ShapeInput, ShapeUnion);
+        XShapeCombineShape (display_info->dpy, c->frame, ShapeInput, 0, 0, 
shape_win, ShapeInput, ShapeSet);
+    }
     XDestroyWindow (display_info->dpy, shape_win);
 }
 

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to