File: group-lost-on-focus-change-fix

package info (click to toggle)
kbdd 0.6-4
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, jessie, jessie-kfreebsd, stretch, trixie, wheezy
  • size: 628 kB
  • ctags: 266
  • sloc: ansic: 1,050; sh: 1,032; makefile: 42; xml: 29
file content (63 lines) | stat: -rw-r--r-- 2,518 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Index: kbdd-0.6/src/libkbdd.c
===================================================================
--- kbdd-0.6.orig/src/libkbdd.c	2011-08-07 05:52:34.000000000 +0400
+++ kbdd-0.6/src/libkbdd.c	2012-05-03 23:37:53.500001008 +0400
@@ -264,15 +264,10 @@
     Window focused_win;
     if (ev->window == _kbdd.focus_win) 
         return;
-
-    if ( (ev->mode == NotifyGrab) ) {
-      focused_win = ev->window;
-    } else {
-      _kbdd_focus_window(ev->window);    
-      dbg("focus event %u", (uint32_t)ev->window);
-      int revert;
-      XGetInputFocus(ev->display, &focused_win, &revert);
-    }
+    _kbdd_focus_window(ev->window);
+    dbg("focus event %u", (uint32_t)ev->window);
+    int revert;
+    XGetInputFocus(ev->display, &focused_win, &revert);
     kbdd_set_window_layout(ev->display, /*ev->window);*/ focused_win);
     XSync(ev->display, 0);
 }
@@ -322,12 +317,17 @@
     {
         case XkbStateNotify:
             dbg( "LIBKBDD state notify event\n");
-            uint32_t grp = ev.state.group;
-            Window focused_win;
-            int revert;
-            XGetInputFocus( ev.any.display, &focused_win, &revert);      
-            if (grp == ev.state.locked_group) //do not save layout with modifier
-                _kbdd_update_window_layout( focused_win, grp);
+            if (ev.state.keycode) {
+                dbg("... state change due to a key press, processing ...");
+                uint32_t grp = ev.state.group;
+                Window focused_win;
+                int revert;
+                XGetInputFocus( ev.any.display, &focused_win, &revert);      
+                if (grp == ev.state.locked_group) //do not save layout with modifier
+                    _kbdd_update_window_layout( focused_win, grp);
+            } else {
+                dbg("... programmatic event, skipping ...");
+            }
             break;
         case XkbNewKeyboardNotify:
             dbg("kbdnotify %u\n",ev.any.xkb_type);
@@ -442,12 +442,8 @@
     Window focused_win;
     int revert;
     if ( XGetInputFocus( _kbdd.display, &focused_win, &revert) )
-    {
-        if (_kbdd.focus_win == focused_win )  //this hack will not save us in case ok KDE+Awesome
-            _kbdd_perwindow_put(focused_win, layout);
-        //else
-        XkbLockGroup( _kbdd.display, XkbUseCoreKbd, layout);
-    }
+        if ( XkbLockGroup( _kbdd.display, XkbUseCoreKbd, layout) )
+            _kbdd_update_window_layout(focused_win, layout);
     dbg("set window layout %u",layout);
 }