changeset 34281:52d927f2b563

X11: support CTRL key and thus key combinations with it.
author reimar
date Thu, 01 Dec 2011 18:34:18 +0000
parents fcadddee0a5a
children 6edabf4151e9
files libvo/x11_common.c
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/x11_common.c	Tue Nov 29 20:15:22 2011 +0000
+++ b/libvo/x11_common.c	Thu Dec 01 18:34:18 2011 +0000
@@ -844,6 +844,7 @@
                 ret |= check_resize();
                 break;
             case KeyPress:
+            case KeyRelease:
                 {
                     int key;
 
@@ -853,10 +854,15 @@
 
                     XLookupString(&Event.xkey, buf, sizeof(buf), &keySym,
                                   &stat);
-                    if (!vo_x11_putkey_ext(keySym)) {
-                        key =
-                            ((keySym & 0xff00) !=
-                             0 ? ((keySym & 0x00ff) + 256) : (keySym));
+                    key =
+                        ((keySym & 0xff00) !=
+                         0 ? ((keySym & 0x00ff) + 256) : (keySym));
+                    if (key == wsLeftCtrl || key == wsRightCtrl) {
+                        mplayer_put_key(KEY_CTRL |
+                            (Event.type == KeyPress ? MP_KEY_DOWN : 0));
+                    } else if (Event.type == KeyRelease) {
+                        break;
+                    } else if (!vo_x11_putkey_ext(keySym)) {
                         vo_x11_putkey(key);
                     }
                     ret |= VO_EVENT_KEYPRESS;
@@ -1095,7 +1101,7 @@
       // if it relies on events being forwarded to the parent of WinID.
       // It also is consistent with the w32_common.c code.
       vo_x11_selectinput_witherr(mDisplay, vo_window,
-          StructureNotifyMask | KeyPressMask | PointerMotionMask |
+          StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |
           ButtonPressMask | ButtonReleaseMask | ExposureMask);
 
     vo_x11_update_geometry();
@@ -1136,7 +1142,7 @@
     XSelectInput(mDisplay, vo_window, NoEventMask);
     XSync(mDisplay, False);
     vo_x11_selectinput_witherr(mDisplay, vo_window,
-          StructureNotifyMask | KeyPressMask | PointerMotionMask |
+          StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |
           ButtonPressMask | ButtonReleaseMask | ExposureMask);
   }
   if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);