Event handling fixes and tweaks (avoid graphics exposure events). Cleanups.
SVN revision: 13564
This commit is contained in:
parent
ebfe1acb5f
commit
a32d4e1e9d
5
src/E.h
5
src/E.h
|
@ -2234,8 +2234,9 @@ Pixmap EWindowGetShapePixmap(Window win);
|
|||
#define EClearArea(win, x, y, w, h, exp) XClearArea(disp, win, x, y, w, h, exp)
|
||||
#define ECreatePixmap(draw, w, h, dep) XCreatePixmap(disp, draw, w, h, dep)
|
||||
#define EFreePixmap(pmap) XFreePixmap(disp, pmap)
|
||||
#define ECreateGC(draw, mask, val) XCreateGC(disp, draw, mask, val)
|
||||
#define EFreeGC(gc) XFreeGC(disp, gc)
|
||||
|
||||
GC ECreateGC(Drawable d, unsigned long mask, XGCValues * val);
|
||||
int EFreeGC(GC gc);
|
||||
|
||||
void ESetColor(XColor * pxc, int r, int g, int b);
|
||||
void EGetColor(const XColor * pxc, int *pr, int *pg, int *pb);
|
||||
|
|
18
src/alert.c
18
src/alert.c
|
@ -237,28 +237,24 @@ ShowAlert(char *text)
|
|||
mask = CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWSaveUnder |
|
||||
CWBackingStore;
|
||||
win = XCreateWindow(dd, DefaultRootWindow(dd), -100, -100, 1, 1, 0,
|
||||
DefaultDepth(dd, DefaultScreen(dd)), InputOutput,
|
||||
DefaultVisual(dd, DefaultScreen(dd)), mask, &att);
|
||||
CopyFromParent, InputOutput, CopyFromParent, mask, &att);
|
||||
|
||||
if (sscanf(str1, "%s", line) > 0)
|
||||
{
|
||||
b1 = XCreateWindow(dd, win, -100, -100, 1, 1, 0,
|
||||
DefaultDepth(dd, DefaultScreen(dd)), InputOutput,
|
||||
DefaultVisual(dd, DefaultScreen(dd)), mask, &att);
|
||||
b1 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
|
||||
InputOutput, CopyFromParent, mask, &att);
|
||||
XMapWindow(dd, b1);
|
||||
}
|
||||
if (sscanf(str2, "%s", line) > 0)
|
||||
{
|
||||
b2 = XCreateWindow(dd, win, -100, -100, 1, 1, 0,
|
||||
DefaultDepth(dd, DefaultScreen(dd)), InputOutput,
|
||||
DefaultVisual(dd, DefaultScreen(dd)), mask, &att);
|
||||
b2 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
|
||||
InputOutput, CopyFromParent, mask, &att);
|
||||
XMapWindow(dd, b2);
|
||||
}
|
||||
if (sscanf(str3, "%s", line) > 0)
|
||||
{
|
||||
b3 = XCreateWindow(dd, win, -100, -100, 1, 1, 0,
|
||||
DefaultDepth(dd, DefaultScreen(dd)), InputOutput,
|
||||
DefaultVisual(dd, DefaultScreen(dd)), mask, &att);
|
||||
b3 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
|
||||
InputOutput, CopyFromParent, mask, &att);
|
||||
XMapWindow(dd, b3);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
*/
|
||||
#include "E.h"
|
||||
|
||||
extern char throw_move_events_away;
|
||||
|
||||
static Window w1 = 0, w2 = 0, w3 = 0, w4 = 0;
|
||||
|
||||
static void
|
||||
|
@ -46,7 +44,6 @@ EdgeTimeout(int val, void *data __UNUSED__)
|
|||
if (ewin && ewin->st.fullscreen)
|
||||
return;
|
||||
|
||||
throw_move_events_away = 1;
|
||||
DeskGetCurrentArea(&ax, &ay);
|
||||
GetAreaSize(&aw, &ah);
|
||||
dx = 0;
|
||||
|
|
49
src/events.c
49
src/events.c
|
@ -56,8 +56,6 @@ static int event_base_render = 0;
|
|||
static int error_base_render = 0;
|
||||
#endif
|
||||
|
||||
char throw_move_events_away = 0;
|
||||
|
||||
static int evq_num = 0;
|
||||
static XEvent *evq_ptr = NULL;
|
||||
|
||||
|
@ -366,7 +364,7 @@ EventsCompress(XEvent * evq, int count)
|
|||
#endif
|
||||
|
||||
/* Loop through event list, starting with latest */
|
||||
for (i = count - 1; i > 0; i--)
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
{
|
||||
ev = evq + i;
|
||||
|
||||
|
@ -377,10 +375,8 @@ EventsCompress(XEvent * evq, int count)
|
|||
break;
|
||||
|
||||
case MotionNotify:
|
||||
if (throw_move_events_away) /* Discard all motion events */
|
||||
j = i;
|
||||
else /* Discard all but last motion event */
|
||||
j = i - 1;
|
||||
/* Discard all but last motion event */
|
||||
j = i - 1;
|
||||
n = 0;
|
||||
for (; j >= 0; j--)
|
||||
{
|
||||
|
@ -438,26 +434,32 @@ EventsCompress(XEvent * evq, int count)
|
|||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ev->type == event_base_shape + ShapeNotify)
|
||||
case EX_EVENT_SHAPE_NOTIFY:
|
||||
n = 0;
|
||||
for (j = i - 1; j >= 0; j--)
|
||||
{
|
||||
n = 0;
|
||||
for (j = i - 1; j >= 0; j--)
|
||||
ev2 = evq + j;
|
||||
if (ev2->type == ev->type &&
|
||||
ev2->xany.window == ev->xany.window)
|
||||
{
|
||||
ev2 = evq + j;
|
||||
if (ev2->type == ev->type &&
|
||||
ev2->xany.window == ev->xany.window)
|
||||
{
|
||||
n++;
|
||||
ev2->type = 0;
|
||||
}
|
||||
n++;
|
||||
ev2->type = 0;
|
||||
}
|
||||
#if ENABLE_DEBUG_EVENTS
|
||||
if (n && EventDebug(EDBUG_TYPE_COMPRESSION))
|
||||
Eprintf("EventsCompress n=%4d %s %#lx\n",
|
||||
n, EventName(ev->type), ev->xmotion.window);
|
||||
#endif
|
||||
}
|
||||
#if ENABLE_DEBUG_EVENTS
|
||||
if (n && EventDebug(EDBUG_TYPE_COMPRESSION))
|
||||
Eprintf("EventsCompress n=%4d %s %#lx\n",
|
||||
n, EventName(ev->type), ev->xmotion.window);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case GraphicsExpose:
|
||||
case NoExpose:
|
||||
/* Not using these */
|
||||
ev->type = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -859,7 +861,6 @@ EventShow(const XEvent * ev)
|
|||
case KeymapNotify:
|
||||
case Expose:
|
||||
case GraphicsExpose:
|
||||
case NoExpose:
|
||||
Eprintf("%#08lx EV-%s: win=%#lx %d+%d %dx%d\n", ser, name, win,
|
||||
ev->xexpose.x, ev->xexpose.y,
|
||||
ev->xexpose.width, ev->xexpose.height);
|
||||
|
|
|
@ -59,8 +59,8 @@ ExtInitWinMain(void)
|
|||
attr.border_pixel = 0;
|
||||
attr.background_pixel = 0;
|
||||
attr.save_under = True;
|
||||
win = XCreateWindow(disp, VRoot.win, 0, 0, VRoot.w, VRoot.h, 0, VRoot.depth,
|
||||
InputOutput, VRoot.vis,
|
||||
win = XCreateWindow(disp, VRoot.win, 0, 0, VRoot.w, VRoot.h, 0,
|
||||
CopyFromParent, InputOutput, CopyFromParent,
|
||||
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
|
||||
CWColormap | CWBackPixel | CWBorderPixel, &attr);
|
||||
|
||||
|
@ -91,8 +91,8 @@ ExtInitWinMain(void)
|
|||
Cursor cs = 0;
|
||||
XColor cl;
|
||||
|
||||
w2 = XCreateWindow(disp, win, 0, 0, 32, 32, 0, VRoot.depth, InputOutput,
|
||||
VRoot.vis,
|
||||
w2 = XCreateWindow(disp, win, 0, 0, 32, 32, 0, CopyFromParent,
|
||||
InputOutput, CopyFromParent,
|
||||
CWOverrideRedirect | CWBackingStore | CWColormap |
|
||||
CWBackPixel | CWBorderPixel, &attr);
|
||||
|
||||
|
|
121
src/x.c
121
src/x.c
|
@ -264,8 +264,8 @@ ECreateWindow(Window parent, int x, int y, int w, int h, int saveunder)
|
|||
attr.save_under = True;
|
||||
else
|
||||
attr.save_under = False;
|
||||
win = XCreateWindow(disp, parent, x, y, w, h, 0, VRoot.depth, InputOutput,
|
||||
VRoot.vis,
|
||||
win = XCreateWindow(disp, parent, x, y, w, h, 0,
|
||||
CopyFromParent, InputOutput, CopyFromParent,
|
||||
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
|
||||
CWColormap | CWBackPixmap | CWBorderPixel, &attr);
|
||||
EXidSet(win, parent, x, y, w, h, VRoot.depth);
|
||||
|
@ -273,6 +273,53 @@ ECreateWindow(Window parent, int x, int y, int w, int h, int saveunder)
|
|||
return win;
|
||||
}
|
||||
|
||||
Window
|
||||
ECreateEventWindow(Window parent, int x, int y, int w, int h)
|
||||
{
|
||||
Window win;
|
||||
XSetWindowAttributes attr;
|
||||
|
||||
attr.override_redirect = False;
|
||||
win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly,
|
||||
CopyFromParent, CWOverrideRedirect, &attr);
|
||||
EXidSet(win, parent, x, y, w, h, VRoot.depth);
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
#if 0 /* Not used */
|
||||
/*
|
||||
* create a window which will accept the keyboard focus when no other
|
||||
* windows have it
|
||||
*/
|
||||
Window
|
||||
ECreateFocusWindow(Window parent, int x, int y, int w, int h)
|
||||
{
|
||||
Window win;
|
||||
XSetWindowAttributes attr;
|
||||
|
||||
attr.backing_store = NotUseful;
|
||||
attr.override_redirect = True;
|
||||
attr.colormap = VRoot.cmap;
|
||||
attr.border_pixel = 0;
|
||||
attr.background_pixel = 0;
|
||||
attr.save_under = False;
|
||||
attr.event_mask = KeyPressMask | FocusChangeMask;
|
||||
|
||||
win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly,
|
||||
CopyFromParent,
|
||||
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
|
||||
CWColormap | CWBackPixel | CWBorderPixel | CWEventMask,
|
||||
&attr);
|
||||
|
||||
XSetWindowBackground(disp, win, 0);
|
||||
XMapWindow(disp, win);
|
||||
XSetInputFocus(disp, win, RevertToParent, CurrentTime);
|
||||
|
||||
return win;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
EMoveWindow(Window win, int x, int y)
|
||||
{
|
||||
|
@ -814,51 +861,6 @@ ESetWindowBackground(Window win, int col)
|
|||
XSetWindowBackground(disp, win, col);
|
||||
}
|
||||
|
||||
Window
|
||||
ECreateEventWindow(Window parent, int x, int y, int w, int h)
|
||||
{
|
||||
Window win;
|
||||
XSetWindowAttributes attr;
|
||||
|
||||
attr.override_redirect = False;
|
||||
win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly, VRoot.vis,
|
||||
CWOverrideRedirect, &attr);
|
||||
EXidSet(win, parent, x, y, w, h, VRoot.depth);
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
/*
|
||||
* create a window which will accept the keyboard focus when no other
|
||||
* windows have it
|
||||
*/
|
||||
Window
|
||||
ECreateFocusWindow(Window parent, int x, int y, int w, int h)
|
||||
{
|
||||
Window win;
|
||||
XSetWindowAttributes attr;
|
||||
|
||||
attr.backing_store = NotUseful;
|
||||
attr.override_redirect = True;
|
||||
attr.colormap = VRoot.cmap;
|
||||
attr.border_pixel = 0;
|
||||
attr.background_pixel = 0;
|
||||
attr.save_under = False;
|
||||
attr.event_mask = KeyPressMask | FocusChangeMask;
|
||||
|
||||
win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly,
|
||||
CopyFromParent,
|
||||
CWOverrideRedirect | CWSaveUnder | CWBackingStore |
|
||||
CWColormap | CWBackPixel | CWBorderPixel | CWEventMask,
|
||||
&attr);
|
||||
|
||||
XSetWindowBackground(disp, win, 0);
|
||||
XMapWindow(disp, win);
|
||||
XSetInputFocus(disp, win, RevertToParent, CurrentTime);
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
void
|
||||
ESelectInputAdd(Window win, long mask)
|
||||
{
|
||||
|
@ -869,6 +871,31 @@ ESelectInputAdd(Window win, long mask)
|
|||
XSelectInput(disp, win, xwa.your_event_mask);
|
||||
}
|
||||
|
||||
GC
|
||||
ECreateGC(Drawable d, unsigned long mask, XGCValues * val)
|
||||
{
|
||||
XGCValues xgcv;
|
||||
|
||||
if (val)
|
||||
{
|
||||
mask |= GCGraphicsExposures;
|
||||
val->graphics_exposures = False;
|
||||
}
|
||||
else
|
||||
{
|
||||
mask = GCGraphicsExposures;
|
||||
val = &xgcv;
|
||||
val->graphics_exposures = False;
|
||||
}
|
||||
return XCreateGC(disp, d, mask, val);
|
||||
}
|
||||
|
||||
int
|
||||
EFreeGC(GC gc)
|
||||
{
|
||||
return XFreeGC(disp, gc);
|
||||
}
|
||||
|
||||
void
|
||||
ESetColor(XColor * pxc, int r, int g, int b)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue