2016-01-07 19:03:19 +00:00
|
|
|
$OpenBSD: patch-keynav_c,v 1.3 2016/01/07 19:03:19 jasper Exp $
|
2016-01-07 18:40:43 +00:00
|
|
|
|
|
|
|
From c822edfbc71a23e9710f00a670f353e3b614084c Mon Sep 17 00:00:00 2001
|
|
|
|
From: Krister Svanlund <krister.svanlund@gmail.com>
|
|
|
|
Date: Sat, 26 May 2012 00:02:03 +0200
|
|
|
|
Subject: [PATCH] Updated keynav to comply with new naming convention of xdotool
|
|
|
|
|
2016-01-07 19:03:19 +00:00
|
|
|
From 4372b9f710391ff58ba67c618569da438df382ad Mon Sep 17 00:00:00 2001
|
|
|
|
From: Krister Svanlund <krister.svanlund@gmail.com>
|
|
|
|
Date: Sat, 26 May 2012 00:05:22 +0200
|
|
|
|
Subject: [PATCH] Replaced XKeycodeToKeysym with XkbKeycodeToKeysym
|
|
|
|
|
2015-01-26 12:54:01 +00:00
|
|
|
--- keynav.c.orig Wed Oct 13 09:27:51 2010
|
2016-01-07 19:03:19 +00:00
|
|
|
+++ keynav.c Thu Jan 7 20:01:01 2016
|
|
|
|
@@ -14,6 +14,7 @@
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
+#include <X11/XKBlib.h>
|
|
|
|
#include <X11/Xresource.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
#include <X11/keysym.h>
|
|
|
|
@@ -287,7 +288,7 @@ int parse_mods(char *keyseq) {
|
2016-01-07 18:40:43 +00:00
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
/* Use all but the last token as modifiers */
|
|
|
|
- const char **symbol_map = xdo_symbol_map();
|
|
|
|
+ const char **symbol_map = xdo_get_symbol_map();
|
|
|
|
for (i = 0; i < mods->len; i++) {
|
|
|
|
KeySym keysym = 0;
|
|
|
|
int j = 0;
|
2016-01-07 19:03:19 +00:00
|
|
|
@@ -526,7 +527,7 @@ int parse_config_line(char *orig_line) {
|
2015-01-26 12:54:01 +00:00
|
|
|
|
|
|
|
tokctx = line;
|
|
|
|
keyseq = strdup(strtok_r(line, " ", &tokctx));
|
|
|
|
- commands = strdup(tokctx);
|
|
|
|
+ commands = (tokctx != NULL) ? strdup(tokctx) : NULL;
|
|
|
|
|
|
|
|
/* A special config option that will clear all keybindings */
|
|
|
|
if (strcmp(keyseq, "clear") == 0) {
|
2016-01-07 19:03:19 +00:00
|
|
|
@@ -849,7 +850,7 @@ void cmd_start(char *args) {
|
2016-01-07 18:40:43 +00:00
|
|
|
|
|
|
|
zone = XCreateSimpleWindow(dpy, viewport->root,
|
|
|
|
wininfo.x, wininfo.y, wininfo.w, wininfo.h, 0, 0, 0);
|
|
|
|
- xdo_window_setclass(xdo, zone, "keynav", "keynav");
|
|
|
|
+ xdo_set_window_class(xdo, zone, "keynav", "keynav");
|
|
|
|
canvas_gc = XCreateGC(dpy, zone, 0, NULL);
|
|
|
|
|
|
|
|
canvas = XCreatePixmap(dpy, zone, viewport->w, viewport->h,
|
2016-01-07 19:03:19 +00:00
|
|
|
@@ -1012,7 +1013,7 @@ void cmd_cursorzoom(char *args) {
|
2016-01-07 18:40:43 +00:00
|
|
|
height = width;
|
|
|
|
}
|
|
|
|
|
|
|
|
- xdo_mouselocation(xdo, &xloc, &yloc, NULL);
|
|
|
|
+ xdo_get_mouse_location(xdo, &xloc, &yloc, NULL);
|
|
|
|
|
|
|
|
wininfo.x = xloc - (width / 2);
|
|
|
|
wininfo.y = yloc - (height / 2);
|
2016-01-07 19:03:19 +00:00
|
|
|
@@ -1026,7 +1027,7 @@ void cmd_windowzoom(char *args) {
|
2016-01-07 18:40:43 +00:00
|
|
|
Window dummy_win;
|
|
|
|
int x, y, width, height, border_width, depth;
|
|
|
|
|
|
|
|
- xdo_window_get_active(xdo, &curwin);
|
|
|
|
+ xdo_get_active_window(xdo, &curwin);
|
|
|
|
XGetGeometry(xdo->xdpy, curwin, &rootwin, &x, &y, &width, &height,
|
|
|
|
&border_width, &depth);
|
|
|
|
XTranslateCoordinates(xdo->xdpy, curwin, rootwin,
|
2016-01-07 19:03:19 +00:00
|
|
|
@@ -1055,8 +1056,8 @@ void cmd_warp(char *args) {
|
2016-01-07 18:40:43 +00:00
|
|
|
mouseinfo.y = y - wininfo.y;
|
|
|
|
openpixel(dpy, zone, &mouseinfo);
|
|
|
|
|
|
|
|
- xdo_mousemove(xdo, x, y, viewports[wininfo.curviewport].screen_num);
|
|
|
|
- xdo_mouse_wait_for_move_to(xdo, x, y);
|
|
|
|
+ xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
|
|
|
|
+ xdo_wait_for_mouse_move_to(xdo, x, y);
|
|
|
|
|
|
|
|
/* TODO(sissel): do we need to open again? */
|
|
|
|
openpixel(dpy, zone, &mouseinfo);
|
2016-01-07 19:03:19 +00:00
|
|
|
@@ -1069,7 +1070,7 @@ void cmd_click(char *args) {
|
2016-01-07 18:40:43 +00:00
|
|
|
int button;
|
|
|
|
button = atoi(args);
|
|
|
|
if (button > 0)
|
|
|
|
- xdo_click(xdo, CURRENTWINDOW, button);
|
|
|
|
+ xdo_click_window(xdo, CURRENTWINDOW, button);
|
|
|
|
else
|
|
|
|
fprintf(stderr, "Negative mouse button is invalid: %d\n", button);
|
|
|
|
}
|
2016-01-07 19:03:19 +00:00
|
|
|
@@ -1107,19 +1108,19 @@ void cmd_drag(char *args) {
|
2016-01-07 18:40:43 +00:00
|
|
|
|
|
|
|
if (ISDRAGGING) { /* End dragging */
|
|
|
|
appstate.dragging = False;
|
|
|
|
- xdo_mouseup(xdo, CURRENTWINDOW, button);
|
|
|
|
+ xdo_mouse_up(xdo, CURRENTWINDOW, button);
|
|
|
|
} else { /* Start dragging */
|
|
|
|
cmd_warp(NULL);
|
|
|
|
appstate.dragging = True;
|
|
|
|
- xdo_keysequence_down(xdo, 0, drag_modkeys, 12000);
|
|
|
|
- xdo_mousedown(xdo, CURRENTWINDOW, button);
|
|
|
|
+ xdo_send_keysequence_window_down(xdo, 0, drag_modkeys, 12000);
|
|
|
|
+ xdo_mouse_down(xdo, CURRENTWINDOW, button);
|
|
|
|
|
|
|
|
/* Sometimes we need to move a little to tell the app we're dragging */
|
|
|
|
/* TODO(sissel): Make this a 'mousewiggle' command */
|
|
|
|
- xdo_mousemove_relative(xdo, 1, 0);
|
|
|
|
- xdo_mousemove_relative(xdo, -1, 0);
|
|
|
|
+ xdo_move_mouse_relative(xdo, 1, 0);
|
|
|
|
+ xdo_move_mouse_relative(xdo, -1, 0);
|
|
|
|
XSync(xdo->xdpy, 0);
|
|
|
|
- xdo_keysequence_up(xdo, 0, drag_modkeys, 12000);
|
|
|
|
+ xdo_send_keysequence_window_up(xdo, 0, drag_modkeys, 12000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-07 19:03:19 +00:00
|
|
|
@@ -1477,7 +1478,7 @@ handler_info_t handle_gridnav(XKeyEvent *e) {
|
|
|
|
index += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
- KeySym sym = XKeycodeToKeysym(dpy, e->keycode, index);
|
|
|
|
+ KeySym sym = XkbKeycodeToKeysym(dpy, e->keycode, 0, index);
|
|
|
|
char *key = XKeysymToString(sym);
|
|
|
|
|
|
|
|
if (sym == XK_Escape) {
|