chiark
/
gitweb
/
~ian
/
chiark-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fishdescriptor: wip utility
[chiark-utils.git]
/
cprogs
/
xduplic-copier.c
diff --git
a/cprogs/xduplic-copier.c
b/cprogs/xduplic-copier.c
index 46ff0d37161c2530e54114115d2520723459412e..d9703a55e72ed42fb2c51c7ae0a7da054deeda22 100644
(file)
--- a/
cprogs/xduplic-copier.c
+++ b/
cprogs/xduplic-copier.c
@@
-20,10
+20,13
@@
#include <X11/cursorfont.h>
#include <X11/cursorfont.h>
#include <X11/Xmu/WinUtil.h>
#include <X11/cursorfont.h>
#include <X11/cursorfont.h>
#include <X11/Xmu/WinUtil.h>
+#include <X11/XKBlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
+#include <string.h>
+#include <unistd.h>
static Display *display;
static int selecting, l1_x, l1_y;
static Display *display;
static int selecting, l1_x, l1_y;
@@
-142,8
+145,7
@@
static void buttonpress(XButtonEvent *e) {
if (e->window != e->root) return;
if (e->window != e->root) return;
- sw= XmuClientWindow(display, e->subwindow);
- if (!sw) {
+ if (!e->subwindow) {
if (!rightbutton) {
stopselecting();
} else {
if (!rightbutton) {
stopselecting();
} else {
@@
-158,6
+160,8
@@
static void buttonpress(XButtonEvent *e) {
return;
}
return;
}
+ sw= XmuClientWindow(display, e->subwindow);
+
if (sw == w) { beep(); return; }
for (ownp=&headwn;
if (sw == w) { beep(); return; }
for (ownp=&headwn;
@@
-199,7
+203,7
@@
static void keypress(XKeyEvent *e) {
(unsigned long)e->time,
e->x,e->y, e->x_root,e->y_root,
e->state, e->keycode, (int)e->same_screen);
(unsigned long)e->time,
e->x,e->y, e->x_root,e->y_root,
e->state, e->keycode, (int)e->same_screen);
- if (X
KeycodeToKeysym(display, e->keycode
, 0) == XK_q) _exit(1);
+ if (X
kbKeycodeToKeysym(display, e->keycode, 0
, 0) == XK_q) _exit(1);
beep(); return;
}
for (own=headwn; own; own=own->next) {
beep(); return;
}
for (own=headwn; own; own=own->next) {
@@
-231,6
+235,7
@@
int main(int argc, const char **argv) {
Font font;
display= XOpenDisplay(0);
Font font;
display= XOpenDisplay(0);
+ if (!display) { fputs("XOpenDisplay failed\n",stderr); exit(-1); }
screen= DefaultScreen(display);
cmap= DefaultColormap(display,screen);
root= DefaultRootWindow(display);
screen= DefaultScreen(display);
cmap= DefaultColormap(display,screen);
root= DefaultRootWindow(display);