Skip to content

Commit eefeef2

Browse files
authored
Revert "--pass-*-keys options (#136)"
1 parent ac6b471 commit eefeef2

File tree

6 files changed

+9
-54
lines changed

6 files changed

+9
-54
lines changed

.github/workflows/Build Test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- name: Install deps
1010
run: |
1111
sudo apt update
12-
sudo apt install pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxcb-xtest0-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
12+
sudo apt install pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
1313
- name: Build
1414
run: ./build.sh
1515
- name: Check and distcheck

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666

6767
- run: |
6868
sudo apt-get update
69-
sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxcb-xtest0-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
69+
sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
7070
./build.sh
7171
7272
- name: Perform CodeQL Analysis

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The following dependencies will need to be installed for a successful build, dep
8484
### Debian
8585
Run this command to install all dependencies:
8686
```
87-
sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util0-dev libxcb-xrm-dev libxcb-xtest0-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
87+
sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util0-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
8888
```
8989
If you still see missing packages during build after installing all of these dependencies, try following the steps [here](https://github.com/Raymo111/i3lock-color/issues/211#issuecomment-809891727).
9090

@@ -98,7 +98,7 @@ sudo dnf install -y autoconf automake cairo-devel fontconfig gcc libev-devel lib
9898
### Ubuntu 18/20.04 LTS
9999
Run this command to install all dependencies:
100100
```
101-
sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxcb-xtest0-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
101+
sudo apt install autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev
102102
```
103103

104104
## Building i3lock-color

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ AC_SEARCH_LIBS([iconv_open], [iconv], , [AC_MSG_FAILURE([cannot find the require
9797

9898
dnl Each prefix corresponds to a source tarball which users might have
9999
dnl downloaded in a newer version and would like to overwrite.
100-
PKG_CHECK_MODULES([XCB], [xcb xcb-xkb xcb-xinerama xcb-randr xcb-composite xcb-xtest])
100+
PKG_CHECK_MODULES([XCB], [xcb xcb-xkb xcb-xinerama xcb-randr xcb-composite])
101101
PKG_CHECK_MODULES([XCB_IMAGE], [xcb-image])
102102
PKG_CHECK_MODULES([XCB_UTIL], [xcb-event xcb-util xcb-atom])
103103
PKG_CHECK_MODULES([XCB_UTIL_XRM], [xcb-xrm])

i3lock.1

-12
Original file line numberDiff line numberDiff line change
@@ -392,18 +392,6 @@ power - XF86PowerDown, XF86PowerOff, XF86Sleep
392392
volume - XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume
393393
.RE
394394

395-
.TP
396-
.B \-\-special\-passthrough
397-
Allows special keys to pass through the locked screen, with \-\-pass\-{media, screen,
398-
power, volume}\-keys. Keystrokes are forcibly sent to the window manager or desktop
399-
environment in three steps: un-grab keyboard, send key, and re-grab the keyboard.
400-
No other keys will be sent to the WM/DE.
401-
402-
Note: ONLY use this option if the special keys are NOT passed through without it.
403-
This could be less safe than the default behavior since the keyboard is ungrabbed for
404-
the keys to be passed through. This HAS been tested though, so there SHOULDN'T be any
405-
security issues.
406-
407395
.TP
408396
.B \-\-bar\-indicator
409397
Replaces the usual ring indicator with a bar indicator. Comes with perks.

i3lock.c

+4-37
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
#endif
5151
#include <xcb/xcb_aux.h>
5252
#include <xcb/randr.h>
53-
#include <xcb/xtest.h>
54-
#include <time.h>
5553

5654
#include "i3lock.h"
5755
#include "xcb.h"
@@ -264,7 +262,6 @@ bool pass_media_keys = false;
264262
bool pass_screen_keys = false;
265263
bool pass_power_keys = false;
266264
bool pass_volume_keys = false;
267-
bool special_passthrough = false;
268265

269266
// for the rendering thread, so we can clean it up
270267
pthread_t draw_thread;
@@ -658,32 +655,6 @@ static bool skip_without_validation(void) {
658655
return false;
659656
}
660657

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-
687658
/*
688659
* Handle key presses. Fixes state, then looks up the key symbol for the
689660
* 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) {
743714
case XKB_KEY_XF86AudioMute:
744715
case XKB_KEY_XF86AudioLowerVolume:
745716
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);
747718
return;
748719
}
749720
}
@@ -753,7 +724,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
753724
switch(ksym) {
754725
case XKB_KEY_XF86MonBrightnessUp:
755726
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);
757728
return;
758729
}
759730
}
@@ -764,7 +735,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
764735
case XKB_KEY_XF86PowerDown:
765736
case XKB_KEY_XF86PowerOff:
766737
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);
768739
return;
769740
}
770741
}
@@ -775,7 +746,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
775746
case XKB_KEY_XF86AudioMute:
776747
case XKB_KEY_XF86AudioLowerVolume:
777748
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);
779750
return;
780751
}
781752
}
@@ -1586,7 +1557,6 @@ int main(int argc, char *argv[]) {
15861557
{"pass-screen-keys", no_argument, NULL, 602},
15871558
{"pass-power-keys", no_argument, NULL, 603},
15881559
{"pass-volume-keys", no_argument, NULL, 604},
1589-
{"special-passthrough", no_argument, NULL, 605},
15901560

15911561
// bar indicator stuff
15921562
{"bar-indicator", no_argument, NULL, 700},
@@ -2148,9 +2118,6 @@ int main(int argc, char *argv[]) {
21482118
case 604:
21492119
pass_volume_keys = true;
21502120
break;
2151-
case 605:
2152-
special_passthrough = true;
2153-
break;
21542121

21552122
// Bar indicator
21562123
case 700:

0 commit comments

Comments
 (0)