1
0
Fork 0
mirror of https://github.com/Raymo111/i3lock-color.git synced 2024-12-02 14:05:43 -05:00

Revert "--pass-*-keys options (#136)" (#253)

This commit is contained in:
Raymond Li 2022-02-03 22:41:46 -05:00 committed by GitHub
parent ac6b471a49
commit 380a10a90f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 54 deletions

View file

@ -9,7 +9,7 @@ jobs:
- name: Install deps - name: Install deps
run: | run: |
sudo apt update sudo apt update
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 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
- name: Build - name: Build
run: ./build.sh run: ./build.sh
- name: Check and distcheck - name: Check and distcheck

View file

@ -66,7 +66,7 @@ jobs:
- run: | - run: |
sudo apt-get update sudo apt-get update
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 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
./build.sh ./build.sh
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis

View file

@ -84,7 +84,7 @@ The following dependencies will need to be installed for a successful build, dep
### Debian ### Debian
Run this command to install all dependencies: Run this command to install all dependencies:
``` ```
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 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
``` ```
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). 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).
@ -98,7 +98,7 @@ sudo dnf install -y autoconf automake cairo-devel fontconfig gcc libev-devel lib
### Ubuntu 18/20.04 LTS ### Ubuntu 18/20.04 LTS
Run this command to install all dependencies: Run this command to install all dependencies:
``` ```
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 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
``` ```
## Building i3lock-color ## Building i3lock-color

View file

@ -97,7 +97,7 @@ AC_SEARCH_LIBS([iconv_open], [iconv], , [AC_MSG_FAILURE([cannot find the require
dnl Each prefix corresponds to a source tarball which users might have dnl Each prefix corresponds to a source tarball which users might have
dnl downloaded in a newer version and would like to overwrite. dnl downloaded in a newer version and would like to overwrite.
PKG_CHECK_MODULES([XCB], [xcb xcb-xkb xcb-xinerama xcb-randr xcb-composite xcb-xtest]) PKG_CHECK_MODULES([XCB], [xcb xcb-xkb xcb-xinerama xcb-randr xcb-composite])
PKG_CHECK_MODULES([XCB_IMAGE], [xcb-image]) PKG_CHECK_MODULES([XCB_IMAGE], [xcb-image])
PKG_CHECK_MODULES([XCB_UTIL], [xcb-event xcb-util xcb-atom]) PKG_CHECK_MODULES([XCB_UTIL], [xcb-event xcb-util xcb-atom])
PKG_CHECK_MODULES([XCB_UTIL_XRM], [xcb-xrm]) PKG_CHECK_MODULES([XCB_UTIL_XRM], [xcb-xrm])

View file

@ -392,18 +392,6 @@ power - XF86PowerDown, XF86PowerOff, XF86Sleep
volume - XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume volume - XF86AudioMute, XF86AudioLowerVolume, XF86AudioRaiseVolume
.RE .RE
.TP
.B \-\-special\-passthrough
Allows special keys to pass through the locked screen, with \-\-pass\-{media, screen,
power, volume}\-keys. Keystrokes are forcibly sent to the window manager or desktop
environment in three steps: un-grab keyboard, send key, and re-grab the keyboard.
No other keys will be sent to the WM/DE.
Note: ONLY use this option if the special keys are NOT passed through without it.
This could be less safe than the default behavior since the keyboard is ungrabbed for
the keys to be passed through. This HAS been tested though, so there SHOULDN'T be any
security issues.
.TP .TP
.B \-\-bar\-indicator .B \-\-bar\-indicator
Replaces the usual ring indicator with a bar indicator. Comes with perks. Replaces the usual ring indicator with a bar indicator. Comes with perks.

View file

@ -50,8 +50,6 @@
#endif #endif
#include <xcb/xcb_aux.h> #include <xcb/xcb_aux.h>
#include <xcb/randr.h> #include <xcb/randr.h>
#include <xcb/xtest.h>
#include <time.h>
#include "i3lock.h" #include "i3lock.h"
#include "xcb.h" #include "xcb.h"
@ -264,7 +262,6 @@ bool pass_media_keys = false;
bool pass_screen_keys = false; bool pass_screen_keys = false;
bool pass_power_keys = false; bool pass_power_keys = false;
bool pass_volume_keys = false; bool pass_volume_keys = false;
bool special_passthrough = false;
// for the rendering thread, so we can clean it up // for the rendering thread, so we can clean it up
pthread_t draw_thread; pthread_t draw_thread;
@ -658,32 +655,6 @@ static bool skip_without_validation(void) {
return false; return false;
} }
/*
* Sends key press event to root/wm
* Releases the keyboard, sends the event, and
* grabs the keyboard again
* */
static void send_key_to_root(xcb_key_press_event_t *event, bool twice) {
if (!special_passthrough) {
xcb_send_event(conn, true, screen->root, XCB_EVENT_MASK_BUTTON_PRESS, (char *)event);
return;
}
xcb_ungrab_keyboard(conn, XCB_CURRENT_TIME);
DEBUG("Received: %d at %ld\n", event->detail, time(0));
xcb_test_fake_input(conn, XCB_KEY_PRESS, event->detail, XCB_CURRENT_TIME, screen->root, 0, 0, 0);
xcb_test_fake_input(conn, XCB_KEY_RELEASE, event->detail, XCB_CURRENT_TIME, screen->root, 0, 0, 0);
if (twice) {
xcb_test_fake_input(conn, XCB_KEY_PRESS, event->detail, XCB_CURRENT_TIME, screen->root, 0, 0, 0);
xcb_test_fake_input(conn, XCB_KEY_RELEASE, event->detail, XCB_CURRENT_TIME, screen->root, 0, 0, 0);
}
xcb_grab_keyboard(conn, true, screen->root, XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_PARENT, win, XCB_CURRENT_TIME);
}
/* /*
* Handle key presses. Fixes state, then looks up the key symbol for the * Handle key presses. Fixes state, then looks up the key symbol for the
* given keycode, then looks up the key symbol (as UCS-2), converts it to * 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) {
case XKB_KEY_XF86AudioMute: case XKB_KEY_XF86AudioMute:
case XKB_KEY_XF86AudioLowerVolume: case XKB_KEY_XF86AudioLowerVolume:
case XKB_KEY_XF86AudioRaiseVolume: case XKB_KEY_XF86AudioRaiseVolume:
send_key_to_root(event, true); xcb_send_event(conn, true, screen->root, XCB_EVENT_MASK_BUTTON_PRESS, (char *)event);
return; return;
} }
} }
@ -753,7 +724,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
switch(ksym) { switch(ksym) {
case XKB_KEY_XF86MonBrightnessUp: case XKB_KEY_XF86MonBrightnessUp:
case XKB_KEY_XF86MonBrightnessDown: case XKB_KEY_XF86MonBrightnessDown:
send_key_to_root(event, false); xcb_send_event(conn, true, screen->root, XCB_EVENT_MASK_BUTTON_PRESS, (char *)event);
return; return;
} }
} }
@ -764,7 +735,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
case XKB_KEY_XF86PowerDown: case XKB_KEY_XF86PowerDown:
case XKB_KEY_XF86PowerOff: case XKB_KEY_XF86PowerOff:
case XKB_KEY_XF86Sleep: case XKB_KEY_XF86Sleep:
send_key_to_root(event, false); xcb_send_event(conn, true, screen->root, XCB_EVENT_MASK_BUTTON_PRESS, (char *)event);
return; return;
} }
} }
@ -775,7 +746,7 @@ static void handle_key_press(xcb_key_press_event_t *event) {
case XKB_KEY_XF86AudioMute: case XKB_KEY_XF86AudioMute:
case XKB_KEY_XF86AudioLowerVolume: case XKB_KEY_XF86AudioLowerVolume:
case XKB_KEY_XF86AudioRaiseVolume: case XKB_KEY_XF86AudioRaiseVolume:
send_key_to_root(event, true); xcb_send_event(conn, true, screen->root, XCB_EVENT_MASK_BUTTON_PRESS, (char *)event);
return; return;
} }
} }
@ -1586,7 +1557,6 @@ int main(int argc, char *argv[]) {
{"pass-screen-keys", no_argument, NULL, 602}, {"pass-screen-keys", no_argument, NULL, 602},
{"pass-power-keys", no_argument, NULL, 603}, {"pass-power-keys", no_argument, NULL, 603},
{"pass-volume-keys", no_argument, NULL, 604}, {"pass-volume-keys", no_argument, NULL, 604},
{"special-passthrough", no_argument, NULL, 605},
// bar indicator stuff // bar indicator stuff
{"bar-indicator", no_argument, NULL, 700}, {"bar-indicator", no_argument, NULL, 700},
@ -2148,9 +2118,6 @@ int main(int argc, char *argv[]) {
case 604: case 604:
pass_volume_keys = true; pass_volume_keys = true;
break; break;
case 605:
special_passthrough = true;
break;
// Bar indicator // Bar indicator
case 700: case 700: