<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>122425</bug_id>
          
          <creation_ts>2006-02-21 17:25:12 +0000</creation_ts>
          <short_desc>kwin doesn&apos;t support XShape1.1 =&gt; disables input shapes e.g for cairo-clock 0.3.1</short_desc>
          <delta_ts>2006-08-10 15:07:30 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>kwin</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Johannes Schaub">Schaub-Johannes</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>416117</commentid>
    <comment_count>0</comment_count>
    <who name="Johannes Schaub">Schaub-Johannes</who>
    <bug_when>2006-02-21 17:25:12 +0000</bug_when>
    <thetext>Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          g++3.4.3 
OS:                Linux

Developing a new applications which uses so-called input-shapes i tried MacSlows&apos; example, which explains its usage (http://macslow.thepimp.net/projects/input_shape_test.c)

but apparently kwin blocks it from using its shape. i tried metacity, and with it, the sample just works.

Input-Shapes are a official feature of the X Extension XShape, spec 1.1. Having kwin to not support it/to block apps from using it, is a shame for KDE. 
Please repair kwin to work properly like metacity in this case does.

thx in advance</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>416126</commentid>
    <comment_count>1</comment_count>
    <who name="Lubos Lunak">l.lunak</who>
    <bug_when>2006-02-21 18:09:12 +0000</bug_when>
    <thetext>Yeah, what a shame for our several months old last stable release that it doesn&apos;t support some extension that&apos;s apparently so new that even X.org 6.9.0 doesn&apos;t include it. I at least cannot find it anywhere, doc/hardcopy/Xext describes only XShape 1.0 and I don&apos;t see anything in the libXext code either.

Where can one find anything about this?
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>416134</commentid>
    <comment_count>2</comment_count>
    <who name="Johannes Schaub">Schaub-Johannes</who>
    <bug_when>2006-02-21 18:21:37 +0000</bug_when>
    <thetext>do &quot;xdpyinfo -ext SHAPE&quot; to see your version.
no, that spec isn&apos;t totally new and is supported by at least Xorg7.0 (and therefore 6.9 too), and metacity 2.8.6, which is of gnome 2.8(!). 
also consider that i was joking when i said that it would be a shame for KDE. everyone knows that KDE doesn&apos;t have to shame for anything :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>416309</commentid>
    <comment_count>3</comment_count>
    <who name="Lubos Lunak">l.lunak</who>
    <bug_when>2006-02-22 09:17:22 +0000</bug_when>
    <thetext>It is new, the newest X.org version at the time of 3.5.0 release was 6.8, which has only XShape 1.0. And this still doesn&apos;t answer the question of any docs for it - I guess it will be again something along the lines of &quot;ask your favourite X developer&quot; :-/.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>416341</commentid>
    <comment_count>4</comment_count>
    <who name="Christian Loose">christian.loose</who>
    <bug_when>2006-02-22 11:22:38 +0000</bug_when>
    <thetext>Keith updated the XShape specification to 1.1 just four days ago. ;-)

See http://webcvs.freedesktop.org/xorg/doc/xorg-docs/specs/Xext/shape.ms?rev=1.4&amp;view=log.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>416434</commentid>
    <comment_count>5</comment_count>
    <who name="Johannes Schaub">Schaub-Johannes</who>
    <bug_when>2006-02-22 16:26:09 +0000</bug_when>
    <thetext>ok you&apos;re soo right. it&apos;s too new. just would be happy if kwin supports it... thx to all</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>459603</commentid>
    <comment_count>6</comment_count>
    <who name="Lubos Lunak">l.lunak</who>
    <bug_when>2006-08-10 15:07:29 +0000</bug_when>
    <thetext>SVN commit 571711 by lunakl:

Support for input shape from XShape1.1.
FEATURE: 122425



 M  +23 -10    client.cpp  
 M  +2 -4      geometry.cpp  
 M  +2 -6      manage.cpp  
 M  +9 -4      utils.cpp  
 M  +4 -2      utils.h  


--- branches/KDE/3.5/kdebase/kwin/client.cpp #571710:571711
@@ -458,24 +458,37 @@
 
 void Client::updateShape()
     {
-    setShapable(TRUE);
+    // workaround for #19644 - shaped windows shouldn&apos;t have decoration
+    if( shape() &amp;&amp; !noBorder()) 
+        {
+        noborder = true;
+        updateDecoration( true );
+        }
     if ( shape() )
-    {
+        {
         XShapeCombineShape(qt_xdisplay(), frameId(), ShapeBounding,
                            clientPos().x(), clientPos().y(),
                            window(), ShapeBounding, ShapeSet);
-    }
+        setShapable(TRUE);
+        }
     else
-    {
+        {
         XShapeCombineMask( qt_xdisplay(), frameId(), ShapeBounding, 0, 0,
                            None, ShapeSet);
-    }
-    // workaround for #19644 - shaped windows shouldn&apos;t have decoration
-    if( shape() &amp;&amp; !noBorder()) 
-        {
-        noborder = true;
-        updateDecoration( true );
         }
+    if( Shape::major() &gt; 1 || Shape::minor() &gt;= 1 ) // has input shape support
+        { // there appears to be no way to find out if a window has input
+          // shape set or not, so always set propagate the input shape
+          // (it&apos;s the same like the bounding shape by default)
+        XShapeCombineMask( qt_xdisplay(), frameId(), ShapeInput, 0, 0,
+                           None, ShapeSet );
+        XShapeCombineShape( qt_xdisplay(), frameId(), ShapeInput,
+                           clientPos().x(), clientPos().y(),
+                           window(), ShapeBounding, ShapeSubtract );
+        XShapeCombineShape( qt_xdisplay(), frameId(), ShapeInput,
+                           clientPos().x(), clientPos().y(),
+                           window(), ShapeInput, ShapeUnion );
+        }
     }
 
 void Client::setMask( const QRegion&amp; reg, int mode )
--- branches/KDE/3.5/kdebase/kwin/geometry.cpp #571710:571711
@@ -1709,8 +1709,7 @@
             cs.width(), cs.height());
         XMoveResizeWindow( qt_xdisplay(), window(), 0, 0, cs.width(), cs.height());
         }
-    if( shape())
-        updateShape();
+    updateShape();
     // SELI TODO won&apos;t this be too expensive?
     updateWorkareaDiffs();
     sendSyntheticConfigureNotify();
@@ -1764,8 +1763,7 @@
             cs.width(), cs.height());
         XMoveResizeWindow( qt_xdisplay(), window(), 0, 0, cs.width(), cs.height());
         }
-    if( shape())
-        updateShape();
+    updateShape();
     updateWorkareaDiffs();
     sendSyntheticConfigureNotify();
     updateWindowRules();
--- branches/KDE/3.5/kdebase/kwin/manage.cpp #571710:571711
@@ -316,12 +316,8 @@
         keepInArea( area, partial_keep_in_area );
 
     XShapeSelectInput( qt_xdisplay(), window(), ShapeNotifyMask );
-    if ( (is_shape = Shape::hasShape( window())) ) 
-        {
-        updateShape();
-        }
-//    else
-//	setShapable(FALSE);
+    is_shape = Shape::hasShape( window());
+    updateShape();
 	
     //CT extra check for stupid jdk 1.3.1. But should make sense in general
     // if client has initial state set to Iconic and is transient with a parent
--- branches/KDE/3.5/kdebase/kwin/utils.cpp #571710:571711
@@ -44,7 +44,7 @@
 // used to store the return values of
 // XShapeQueryExtension.
 // Necessary since shaped window are an extension to X
-int Shape::kwin_has_shape = 0;
+int Shape::kwin_shape_version = 0;
 int Shape::kwin_shape_event = 0;
 
 // does the window w  need a shape combine mask around it?
@@ -53,7 +53,7 @@
     int xws, yws, xbs, ybs;
     unsigned int wws, hws, wbs, hbs;
     int boundingShaped = 0, clipShaped = 0;
-    if (!kwin_has_shape)
+    if (!available())
         return FALSE;
     XShapeQueryExtents(qt_xdisplay(), w,
                        &amp;boundingShaped, &amp;xws, &amp;yws, &amp;wws, &amp;hws,
@@ -68,9 +68,14 @@
 
 void Shape::init()
     {
+    kwin_shape_version = 0;
     int dummy;
-    kwin_has_shape =
-      XShapeQueryExtension(qt_xdisplay(), &amp;kwin_shape_event, &amp;dummy);
+    if( !XShapeQueryExtension(qt_xdisplay(), &amp;kwin_shape_event, &amp;dummy))
+        return;
+    int major, minor;
+    if( !XShapeQueryVersion( qt_xdisplay(), &amp;major, &amp;minor ))
+        return;
+    kwin_shape_version = major * 16 + minor;
     }
 
 void Motif::readFlags( WId w, bool&amp; noborder, bool&amp; resize, bool&amp; move,
--- branches/KDE/3.5/kdebase/kwin/utils.h #571710:571711
@@ -111,12 +111,14 @@
 class Shape 
     {
     public:
-        static bool available() { return kwin_has_shape; }
+        static bool available() { return kwin_shape_version &gt; 0; }
+        static int major() { return kwin_shape_version / 16; }
+        static int minor() { return kwin_shape_version % 16; }
         static bool hasShape( WId w);
         static int shapeEvent();
         static void init();
     private:
-        static int kwin_has_shape;
+        static int kwin_shape_version; // as 16*major+minor
         static int kwin_shape_event;
     };
 
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>