comparison libvo/x11_common.c @ 34281:52d927f2b563

X11: support CTRL key and thus key combinations with it.
author reimar
date Thu, 01 Dec 2011 18:34:18 +0000
parents 99fceaf417ad
children e60d8bdb4795
comparison
equal deleted inserted replaced
34280:fcadddee0a5a 34281:52d927f2b563
842 if (vo_window == None) 842 if (vo_window == None)
843 break; 843 break;
844 ret |= check_resize(); 844 ret |= check_resize();
845 break; 845 break;
846 case KeyPress: 846 case KeyPress:
847 case KeyRelease:
847 { 848 {
848 int key; 849 int key;
849 850
850 #ifdef CONFIG_GUI 851 #ifdef CONFIG_GUI
851 if ( use_gui ) { break; } 852 if ( use_gui ) { break; }
852 #endif 853 #endif
853 854
854 XLookupString(&Event.xkey, buf, sizeof(buf), &keySym, 855 XLookupString(&Event.xkey, buf, sizeof(buf), &keySym,
855 &stat); 856 &stat);
856 if (!vo_x11_putkey_ext(keySym)) { 857 key =
857 key = 858 ((keySym & 0xff00) !=
858 ((keySym & 0xff00) != 859 0 ? ((keySym & 0x00ff) + 256) : (keySym));
859 0 ? ((keySym & 0x00ff) + 256) : (keySym)); 860 if (key == wsLeftCtrl || key == wsRightCtrl) {
861 mplayer_put_key(KEY_CTRL |
862 (Event.type == KeyPress ? MP_KEY_DOWN : 0));
863 } else if (Event.type == KeyRelease) {
864 break;
865 } else if (!vo_x11_putkey_ext(keySym)) {
860 vo_x11_putkey(key); 866 vo_x11_putkey(key);
861 } 867 }
862 ret |= VO_EVENT_KEYPRESS; 868 ret |= VO_EVENT_KEYPRESS;
863 } 869 }
864 break; 870 break;
1093 } else 1099 } else
1094 // Do not capture events since it might break the parent application 1100 // Do not capture events since it might break the parent application
1095 // if it relies on events being forwarded to the parent of WinID. 1101 // if it relies on events being forwarded to the parent of WinID.
1096 // It also is consistent with the w32_common.c code. 1102 // It also is consistent with the w32_common.c code.
1097 vo_x11_selectinput_witherr(mDisplay, vo_window, 1103 vo_x11_selectinput_witherr(mDisplay, vo_window,
1098 StructureNotifyMask | KeyPressMask | PointerMotionMask | 1104 StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |
1099 ButtonPressMask | ButtonReleaseMask | ExposureMask); 1105 ButtonPressMask | ButtonReleaseMask | ExposureMask);
1100 1106
1101 vo_x11_update_geometry(); 1107 vo_x11_update_geometry();
1102 goto final; 1108 goto final;
1103 } 1109 }
1134 } while (xev.type != MapNotify || xev.xmap.event != vo_window); 1140 } while (xev.type != MapNotify || xev.xmap.event != vo_window);
1135 vo_x11_clearwindow(mDisplay, vo_window); 1141 vo_x11_clearwindow(mDisplay, vo_window);
1136 XSelectInput(mDisplay, vo_window, NoEventMask); 1142 XSelectInput(mDisplay, vo_window, NoEventMask);
1137 XSync(mDisplay, False); 1143 XSync(mDisplay, False);
1138 vo_x11_selectinput_witherr(mDisplay, vo_window, 1144 vo_x11_selectinput_witherr(mDisplay, vo_window,
1139 StructureNotifyMask | KeyPressMask | PointerMotionMask | 1145 StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |
1140 ButtonPressMask | ButtonReleaseMask | ExposureMask); 1146 ButtonPressMask | ButtonReleaseMask | ExposureMask);
1141 } 1147 }
1142 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); 1148 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
1143 if (!geometry_xy_changed) 1149 if (!geometry_xy_changed)
1144 vo_x11_update_geometry(); 1150 vo_x11_update_geometry();