Skip to content

Instantly share code, notes, and snippets.

@co3k
Created July 11, 2012 18:31
Show Gist options
  • Save co3k/3092210 to your computer and use it in GitHub Desktop.
Save co3k/3092210 to your computer and use it in GitHub Desktop.

Make sure that the workaround patch is reverted:

$ git show
commit d698010c96820bf6de84e6ea28f7003974ec9075
Author: Kousuke Ebihara <[email protected]>
Date:   Wed Jul 11 23:42:26 2012 +0900

    Revert "[WORKAROUND] changed to execute gesture action even if it can't get any gesture-windows"

    This reverts commit 11e4b3d6cc0ca313ec0d29f45546eb3b9850d187.

diff --git a/src/touchegg/gestures/handler/GestureHandler.cpp b/src/touchegg/gestures/handler/GestureHandler.cpp
index 3180cec..3dece6c 100644
--- a/src/touchegg/gestures/handler/GestureHandler.cpp
+++ b/src/touchegg/gestures/handler/GestureHandler.cpp
@@ -196,14 +196,10 @@ Gesture *GestureHandler::createGesture(const QString &type, int id,
         return NULL;

     // Vemos sobre que ventana se ha ejecutado
-    int childWindowId = attrs.value(GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID).toInt();
-    Window gestureWindow = this->getGestureWindow(childWindowId);
-
-    if (gestureWindow == None) {
-        qDebug() << "[+] Missing gesture window:";
-        qDebug() << "\tChild Window Id ->" << childWindowId;
-    }
-
+    Window gestureWindow = this->getGestureWindow(
+            attrs.value(GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID).toInt());
+    if (gestureWindow == None)
+        return NULL;
     QString appClass = this->getAppClass(gestureWindow);

     // Creamos y asignamos la acción asociada al gesto

Check my debug configuration:

$ git diff
diff --git a/touchegg.pro b/touchegg.pro
index 520d4f8..4cb0b00 100644
--- a/touchegg.pro
+++ b/touchegg.pro
@@ -11,6 +11,8 @@ INSTALLS    += target config

 include(src/touchegg/touchegg.pri)

+CONFIG += debug
+
 OTHER_FILES += \
     documentation/doxyfile_es \
     documentation/doxyfile_en \

Make minimize touchegg.conf:

$ cat ~/.config/touchegg/touchegg.conf
<touchégg>
    <settings>
        <property name="composed_gestures_time">0</property>
    </settings>

    <application name="All">
        <gesture type="DRAG" fingers="4" direction="UP">
            <action type="SEND_KEYS">Super+W</action>
        </gesture>
    </application>
</touchégg>

Build:

$ make clean && qmake && make

Execute compiled binary:

$ /home/co3k/src/touchegg/touchegg

Check pid of touchegg:

$ ps ax | grep touchegg
16490 pts/2    Sl+    0:00 /home/co3k/src/touchegg/touchegg

Execute gdb:

# gdb

**snip**

(gdb) attach 16490
Attaching to process 16490
Reading symbols from /home/co3k/src/touchegg/touchegg...done.
Reading symbols from /usr/lib/i386-linux-gnu/libutouch-geis.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/i386-linux-gnu/libutouch-geis.so.1

**snip**

(gdb) b GestureHandler::getGestureWindow
Breakpoint 1 at 0x80553ed: file src/touchegg/gestures/handler/GestureHandler.cpp, line 231.
(gdb) c
Continuing.

Breakpoint 1, GestureHandler::getGestureWindow (this=0x82d2728, window=176) at src/touchegg/gestures/handler/GestureHandler.cpp:231
231     Window topIn = this->getTopLevelWindow(window);
(gdb) s
GestureHandler::getTopLevelWindow (this=0x82d2728, window=176) at src/touchegg/gestures/handler/GestureHandler.cpp:283
283             &numChildren) != 0) {
(gdb) n
282     if (XQueryTree(QX11Info::display(), window, &root, &parent, &children,
(gdb)
284         if (children != NULL)
(gdb) print window
$1 = 176
(gdb) print root
$2 = 176
(gdb) print parent
$3 = 0
(gdb) print children
$4 = (Window *) 0x86ada80
(gdb) n
285             XFree(children);
(gdb)
287         if (parent == root)
(gdb)
290             return this->getTopLevelWindow(parent);
(gdb) print parent
$5 = 0
(gdb) s
GestureHandler::getTopLevelWindow (this=0x82d2728, window=0) at src/touchegg/gestures/handler/GestureHandler.cpp:283
283             &numChildren) != 0) {
(gdb) n
282     if (XQueryTree(QX11Info::display(), window, &root, &parent, &children,
(gdb) print window
$6 = 0
(gdb) print root
$7 = 0
(gdb) print parent
$8 = 134600510
(gdb) print children
$9 = (Window *) 0xbfe30648
(gdb) n
293         return None;
(gdb)
295 }
(gdb)
295 }
(gdb)
GestureHandler::getGestureWindow (this=0x82d2728, window=176) at src/touchegg/gestures/handler/GestureHandler.cpp:232
232     if (topIn == None)
(gdb) print topIn
$10 = 0
(gdb) n
233         return None;
(gdb)
274 }
(gdb)
GestureHandler::createGesture (this=0x82d2728, type=..., id=0, attrs=..., isComposedGesture=false) at src/touchegg/gestures/handler/GestureHandler.cpp:201
201     if (gestureWindow == None)
(gdb) print gestureWindow
$11 = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment