50
50
#endif
51
51
#include <xcb/xcb_aux.h>
52
52
#include <xcb/randr.h>
53
- #include <xcb/xtest.h>
54
- #include <time.h>
55
53
56
54
#include "i3lock.h"
57
55
#include "xcb.h"
@@ -264,7 +262,6 @@ bool pass_media_keys = false;
264
262
bool pass_screen_keys = false;
265
263
bool pass_power_keys = false;
266
264
bool pass_volume_keys = false;
267
- bool special_passthrough = false;
268
265
269
266
// for the rendering thread, so we can clean it up
270
267
pthread_t draw_thread ;
@@ -658,32 +655,6 @@ static bool skip_without_validation(void) {
658
655
return false;
659
656
}
660
657
661
- /*
662
- * Sends key press event to root/wm
663
- * Releases the keyboard, sends the event, and
664
- * grabs the keyboard again
665
- * */
666
- static void send_key_to_root (xcb_key_press_event_t * event , bool twice ) {
667
- if (!special_passthrough ) {
668
- xcb_send_event (conn , true, screen -> root , XCB_EVENT_MASK_BUTTON_PRESS , (char * )event );
669
- return ;
670
- }
671
-
672
- xcb_ungrab_keyboard (conn , XCB_CURRENT_TIME );
673
- DEBUG ("Received: %d at %ld\n" , event -> detail , time (0 ));
674
-
675
- xcb_test_fake_input (conn , XCB_KEY_PRESS , event -> detail , XCB_CURRENT_TIME , screen -> root , 0 , 0 , 0 );
676
- xcb_test_fake_input (conn , XCB_KEY_RELEASE , event -> detail , XCB_CURRENT_TIME , screen -> root , 0 , 0 , 0 );
677
-
678
- if (twice ) {
679
- xcb_test_fake_input (conn , XCB_KEY_PRESS , event -> detail , XCB_CURRENT_TIME , screen -> root , 0 , 0 , 0 );
680
- xcb_test_fake_input (conn , XCB_KEY_RELEASE , event -> detail , XCB_CURRENT_TIME , screen -> root , 0 , 0 , 0 );
681
- }
682
-
683
- xcb_grab_keyboard (conn , true, screen -> root , XCB_CURRENT_TIME , XCB_GRAB_MODE_ASYNC , XCB_GRAB_MODE_ASYNC );
684
- xcb_set_input_focus (conn , XCB_INPUT_FOCUS_PARENT , win , XCB_CURRENT_TIME );
685
- }
686
-
687
658
/*
688
659
* Handle key presses. Fixes state, then looks up the key symbol for the
689
660
* given keycode, then looks up the key symbol (as UCS-2), converts it to
@@ -743,7 +714,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
743
714
case XKB_KEY_XF86AudioMute :
744
715
case XKB_KEY_XF86AudioLowerVolume :
745
716
case XKB_KEY_XF86AudioRaiseVolume :
746
- send_key_to_root ( event , true);
717
+ xcb_send_event ( conn , true, screen -> root , XCB_EVENT_MASK_BUTTON_PRESS , ( char * ) event );
747
718
return ;
748
719
}
749
720
}
@@ -753,7 +724,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
753
724
switch (ksym ) {
754
725
case XKB_KEY_XF86MonBrightnessUp :
755
726
case XKB_KEY_XF86MonBrightnessDown :
756
- send_key_to_root ( event , false );
727
+ xcb_send_event ( conn , true, screen -> root , XCB_EVENT_MASK_BUTTON_PRESS , ( char * ) event );
757
728
return ;
758
729
}
759
730
}
@@ -764,7 +735,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
764
735
case XKB_KEY_XF86PowerDown :
765
736
case XKB_KEY_XF86PowerOff :
766
737
case XKB_KEY_XF86Sleep :
767
- send_key_to_root ( event , false );
738
+ xcb_send_event ( conn , true, screen -> root , XCB_EVENT_MASK_BUTTON_PRESS , ( char * ) event );
768
739
return ;
769
740
}
770
741
}
@@ -775,7 +746,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
775
746
case XKB_KEY_XF86AudioMute :
776
747
case XKB_KEY_XF86AudioLowerVolume :
777
748
case XKB_KEY_XF86AudioRaiseVolume :
778
- send_key_to_root ( event , true);
749
+ xcb_send_event ( conn , true, screen -> root , XCB_EVENT_MASK_BUTTON_PRESS , ( char * ) event );
779
750
return ;
780
751
}
781
752
}
@@ -1586,7 +1557,6 @@ int main(int argc, char *argv[]) {
1586
1557
{"pass-screen-keys" , no_argument , NULL , 602 },
1587
1558
{"pass-power-keys" , no_argument , NULL , 603 },
1588
1559
{"pass-volume-keys" , no_argument , NULL , 604 },
1589
- {"special-passthrough" , no_argument , NULL , 605 },
1590
1560
1591
1561
// bar indicator stuff
1592
1562
{"bar-indicator" , no_argument , NULL , 700 },
@@ -2148,9 +2118,6 @@ int main(int argc, char *argv[]) {
2148
2118
case 604 :
2149
2119
pass_volume_keys = true;
2150
2120
break ;
2151
- case 605 :
2152
- special_passthrough = true;
2153
- break ;
2154
2121
2155
2122
// Bar indicator
2156
2123
case 700 :
0 commit comments