Attempt to set event masks consistently.
SVN revision: 9736
This commit is contained in:
parent
a98f2945b0
commit
e47600e918
4
src/E.h
4
src/E.h
|
@ -877,6 +877,7 @@ typedef struct _winclient
|
|||
char mwm_func_maximize;
|
||||
char mwm_func_close;
|
||||
unsigned int app_state;
|
||||
long event_mask;
|
||||
}
|
||||
WinClient;
|
||||
|
||||
|
@ -1730,8 +1731,7 @@ void RealiseEwinWinpart(EWin * ewin, int i);
|
|||
void ChangeEwinWinpart(EWin * ewin, int i);
|
||||
void EwinBorderDraw(EWin * ewin, int do_shape, int queue_off);
|
||||
int ChangeEwinWinpartContents(EWin * ewin, int i);
|
||||
EWin *EwinCreate(void);
|
||||
void EwinDestroy(EWin * ewin);
|
||||
void EwinEventDestroy(EWin * ewin);
|
||||
void EwinEventMap(EWin * ewin);
|
||||
void EwinEventUnmap(EWin * ewin);
|
||||
void EwinSetArea(EWin * ewin, int ax, int ay);
|
||||
|
|
162
src/borders.c
162
src/borders.c
|
@ -23,11 +23,32 @@
|
|||
#include "E.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
#define EWIN_TOP_EVENT_MASK \
|
||||
(ButtonPressMask | ButtonReleaseMask | \
|
||||
EnterWindowMask | LeaveWindowMask | PointerMotionMask | \
|
||||
StructureNotifyMask)
|
||||
#define EWIN_CONTAINER_EVENT_MASK \
|
||||
(ButtonPressMask | ButtonReleaseMask | \
|
||||
StructureNotifyMask | ResizeRedirectMask | \
|
||||
SubstructureNotifyMask | SubstructureRedirectMask)
|
||||
#define EWIN_BORDER_PART_EVENT_MASK \
|
||||
(KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
|
||||
EnterWindowMask | LeaveWindowMask | PointerMotionMask | ExposureMask)
|
||||
#define EWIN_BORDER_TITLE_EVENT_MASK \
|
||||
(EWIN_BORDER_PART_EVENT_MASK | ExposureMask)
|
||||
|
||||
#define EWIN_CLIENT_EVENT_MASK \
|
||||
(EnterWindowMask | LeaveWindowMask | FocusChangeMask | \
|
||||
StructureNotifyMask | ResizeRedirectMask | \
|
||||
PropertyChangeMask | ColormapChangeMask)
|
||||
|
||||
static void EwinSetBorderInit(EWin * ewin);
|
||||
static void EwinSetBorderTo(EWin * ewin, Border * b);
|
||||
static void DetermineEwinArea(EWin * ewin);
|
||||
EWin *Adopt(Window win);
|
||||
EWin *AdoptInternal(Window win, Border * border, int type);
|
||||
static EWin *EwinCreate(Window win);
|
||||
static EWin *Adopt(Window win);
|
||||
static EWin *AdoptInternal(Window win, Border * border, int type);
|
||||
static void EwinEventsConfigure(EWin * ewin, int mode);
|
||||
|
||||
void
|
||||
DetermineEwinFloat(EWin * ewin, int dx, int dy)
|
||||
|
@ -1092,15 +1113,16 @@ HonorIclass(char *s, int id)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
EWin *
|
||||
static EWin *
|
||||
Adopt(Window win)
|
||||
{
|
||||
EWin *ewin;
|
||||
|
||||
EDBUG(4, "Adopt");
|
||||
|
||||
GrabX();
|
||||
ewin = EwinCreate();
|
||||
ewin->client.win = win;
|
||||
ewin = EwinCreate(win);
|
||||
|
||||
ICCCM_AdoptStart(ewin);
|
||||
ICCCM_GetTitle(ewin, 0);
|
||||
ICCCM_GetHints(ewin, 0);
|
||||
|
@ -1114,14 +1136,13 @@ Adopt(Window win)
|
|||
MatchEwinToSnapInfo(ewin);
|
||||
ICCCM_GetEInfo(ewin);
|
||||
|
||||
AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
|
||||
|
||||
if (!ewin->border)
|
||||
EwinSetBorderInit(ewin);
|
||||
EwinSetBorderTo(ewin, NULL);
|
||||
|
||||
ICCCM_MatchSize(ewin);
|
||||
ICCCM_Adopt(ewin);
|
||||
EwinEventsConfigure(ewin, 0);
|
||||
|
||||
UngrabX();
|
||||
|
||||
|
@ -1134,15 +1155,16 @@ Adopt(Window win)
|
|||
EDBUG_RETURN(ewin);
|
||||
}
|
||||
|
||||
EWin *
|
||||
static EWin *
|
||||
AdoptInternal(Window win, Border * border, int type)
|
||||
{
|
||||
EWin *ewin;
|
||||
|
||||
EDBUG(4, "AdoptInternal");
|
||||
|
||||
GrabX();
|
||||
ewin = EwinCreate();
|
||||
ewin->client.win = win;
|
||||
ewin = EwinCreate(win);
|
||||
|
||||
ewin->border = border;
|
||||
ewin->internal = 1;
|
||||
ewin->type = type;
|
||||
|
@ -1176,14 +1198,13 @@ AdoptInternal(Window win, Border * border, int type)
|
|||
ICCCM_GetGeoms(ewin, 0);
|
||||
MatchEwinToSnapInfo(ewin);
|
||||
|
||||
AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
|
||||
|
||||
if (!ewin->border)
|
||||
EwinSetBorderInit(ewin);
|
||||
EwinSetBorderTo(ewin, NULL);
|
||||
|
||||
ICCCM_MatchSize(ewin);
|
||||
ICCCM_Adopt(ewin);
|
||||
EwinEventsConfigure(ewin, 0);
|
||||
|
||||
UngrabX();
|
||||
|
||||
|
@ -1196,8 +1217,8 @@ AdoptInternal(Window win, Border * border, int type)
|
|||
EDBUG_RETURN(ewin);
|
||||
}
|
||||
|
||||
EWin *
|
||||
EwinCreate(void)
|
||||
static EWin *
|
||||
EwinCreate(Window win)
|
||||
{
|
||||
EWin *ewin;
|
||||
XSetWindowAttributes att;
|
||||
|
@ -1248,24 +1269,27 @@ EwinCreate(void)
|
|||
ewin->area_x = -1;
|
||||
ewin->area_y = -1;
|
||||
|
||||
att.event_mask =
|
||||
StructureNotifyMask | ResizeRedirectMask | ButtonPressMask |
|
||||
ButtonReleaseMask | SubstructureNotifyMask | SubstructureRedirectMask;
|
||||
att.event_mask = EWIN_CONTAINER_EVENT_MASK;
|
||||
att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;
|
||||
XChangeWindowAttributes(disp, ewin->win_container,
|
||||
CWEventMask | CWDontPropagate, &att);
|
||||
EMapWindow(disp, ewin->win_container);
|
||||
att.event_mask =
|
||||
StructureNotifyMask | PointerMotionMask | ButtonPressMask |
|
||||
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask;
|
||||
|
||||
att.event_mask = EWIN_TOP_EVENT_MASK;
|
||||
att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;
|
||||
XChangeWindowAttributes(disp, ewin->win, CWEventMask | CWDontPropagate,
|
||||
&att);
|
||||
XChangeWindowAttributes(disp, ewin->win,
|
||||
CWEventMask | CWDontPropagate, &att);
|
||||
FocusEwinSetGrabs(ewin);
|
||||
GrabButtonGrabs(ewin);
|
||||
EwinListAdd(&EwinListStack, ewin);
|
||||
EwinListAdd(&EwinListFocus, ewin);
|
||||
|
||||
ewin->client.win = win;
|
||||
ewin->client.event_mask = EWIN_CLIENT_EVENT_MASK;
|
||||
AddItem(ewin, "EWIN", win, LIST_TYPE_EWIN);
|
||||
|
||||
XShapeSelectInput(disp, win, ShapeNotifyMask);
|
||||
|
||||
EDBUG_RETURN(ewin);
|
||||
}
|
||||
|
||||
|
@ -1279,7 +1303,7 @@ EwinRemoveFromGroups(EWin * ewin)
|
|||
RemoveEwinFromGroup(ewin, ewin->groups[0]);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
EwinDestroy(EWin * ewin)
|
||||
{
|
||||
EWin *ewin2;
|
||||
|
@ -1345,6 +1369,12 @@ EwinDestroy(EWin * ewin)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
EwinEventDestroy(EWin * ewin)
|
||||
{
|
||||
EwinDestroy(ewin);
|
||||
}
|
||||
|
||||
void
|
||||
EwinEventMap(EWin * ewin)
|
||||
{
|
||||
|
@ -1519,20 +1549,11 @@ EwinSetBorderTo(EWin * ewin, Border * b)
|
|||
* OwnerGrabButtonMask
|
||||
*/
|
||||
if (b->part[i].flags & FLAG_TITLE)
|
||||
{
|
||||
XSelectInput(disp, ewin->bits[i].win,
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
ButtonPressMask | ButtonReleaseMask |
|
||||
EnterWindowMask | LeaveWindowMask |
|
||||
PointerMotionMask);
|
||||
}
|
||||
XSelectInput(disp, ewin->bits[i].win,
|
||||
EWIN_BORDER_TITLE_EVENT_MASK);
|
||||
else
|
||||
{
|
||||
XSelectInput(disp, ewin->bits[i].win,
|
||||
KeyPressMask | KeyReleaseMask | ButtonPressMask |
|
||||
ButtonReleaseMask | EnterWindowMask |
|
||||
LeaveWindowMask | PointerMotionMask);
|
||||
}
|
||||
XSelectInput(disp, ewin->bits[i].win,
|
||||
EWIN_BORDER_PART_EVENT_MASK);
|
||||
ewin->bits[i].x = -10;
|
||||
ewin->bits[i].y = -10;
|
||||
ewin->bits[i].w = -10;
|
||||
|
@ -3171,87 +3192,38 @@ static void
|
|||
EwinEventsConfigure(EWin * ewin, int mode)
|
||||
{
|
||||
int i;
|
||||
long emask;
|
||||
|
||||
if (mode)
|
||||
{
|
||||
XSelectInput(disp, ewin->win,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask |
|
||||
PropertyChangeMask | ResizeRedirectMask);
|
||||
emask = ~(EnterWindowMask | LeaveWindowMask);
|
||||
|
||||
if (ewin->pager)
|
||||
{
|
||||
#if 0 /* ??? */
|
||||
XSelectInput(disp, ewin->client.win,
|
||||
PropertyChangeMask | FocusChangeMask |
|
||||
ResizeRedirectMask | StructureNotifyMask |
|
||||
ColormapChangeMask | ButtonPressMask |
|
||||
ButtonReleaseMask | PointerMotionMask);
|
||||
#endif
|
||||
}
|
||||
else if (ewin->dialog)
|
||||
XSelectInput(disp, ewin->client.win,
|
||||
PropertyChangeMask | FocusChangeMask |
|
||||
ResizeRedirectMask | StructureNotifyMask |
|
||||
ColormapChangeMask | ExposureMask | KeyPressMask);
|
||||
else
|
||||
XSelectInput(disp, ewin->client.win,
|
||||
PropertyChangeMask | FocusChangeMask |
|
||||
ResizeRedirectMask | StructureNotifyMask |
|
||||
ColormapChangeMask);
|
||||
XSelectInput(disp, ewin->win, EWIN_TOP_EVENT_MASK & emask);
|
||||
XSelectInput(disp, ewin->client.win, ewin->client.event_mask & emask);
|
||||
|
||||
for (i = 0; i < ewin->border->num_winparts; i++)
|
||||
{
|
||||
if (ewin->border->part[i].flags & FLAG_TITLE)
|
||||
XSelectInput(disp, ewin->bits[i].win,
|
||||
ExposureMask | ButtonPressMask |
|
||||
ButtonReleaseMask);
|
||||
EWIN_BORDER_TITLE_EVENT_MASK & emask);
|
||||
else
|
||||
XSelectInput(disp, ewin->bits[i].win,
|
||||
ButtonPressMask | ButtonReleaseMask);
|
||||
EWIN_BORDER_PART_EVENT_MASK & emask);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XSelectInput(disp, ewin->win,
|
||||
SubstructureNotifyMask | SubstructureRedirectMask |
|
||||
EnterWindowMask | LeaveWindowMask | PointerMotionMask
|
||||
| PropertyChangeMask | ResizeRedirectMask |
|
||||
ButtonPressMask | ButtonReleaseMask);
|
||||
|
||||
if (ewin->pager)
|
||||
XSelectInput(disp, ewin->client.win,
|
||||
PropertyChangeMask | EnterWindowMask |
|
||||
LeaveWindowMask | FocusChangeMask |
|
||||
ResizeRedirectMask | StructureNotifyMask |
|
||||
ColormapChangeMask | ButtonPressMask |
|
||||
ButtonReleaseMask | PointerMotionMask);
|
||||
else if (ewin->dialog)
|
||||
XSelectInput(disp, ewin->client.win,
|
||||
PropertyChangeMask | EnterWindowMask |
|
||||
LeaveWindowMask | FocusChangeMask |
|
||||
ResizeRedirectMask | StructureNotifyMask |
|
||||
ColormapChangeMask | ExposureMask | KeyPressMask);
|
||||
else
|
||||
XSelectInput(disp, ewin->client.win,
|
||||
PropertyChangeMask | EnterWindowMask |
|
||||
LeaveWindowMask | FocusChangeMask |
|
||||
ResizeRedirectMask | StructureNotifyMask |
|
||||
ColormapChangeMask);
|
||||
XSelectInput(disp, ewin->win, EWIN_TOP_EVENT_MASK);
|
||||
XSelectInput(disp, ewin->client.win, ewin->client.event_mask);
|
||||
|
||||
for (i = 0; i < ewin->border->num_winparts; i++)
|
||||
{
|
||||
if (ewin->border->part[i].flags & FLAG_TITLE)
|
||||
XSelectInput(disp, ewin->bits[i].win,
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
ButtonPressMask | ButtonReleaseMask |
|
||||
EnterWindowMask | LeaveWindowMask |
|
||||
PointerMotionMask);
|
||||
EWIN_BORDER_TITLE_EVENT_MASK);
|
||||
else
|
||||
XSelectInput(disp, ewin->bits[i].win,
|
||||
KeyPressMask | KeyReleaseMask |
|
||||
ButtonPressMask | ButtonReleaseMask |
|
||||
EnterWindowMask | LeaveWindowMask |
|
||||
PointerMotionMask);
|
||||
EWIN_BORDER_PART_EVENT_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define EDESK_EVENT_MASK \
|
||||
(KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
|
||||
EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | \
|
||||
SubstructureNotifyMask | SubstructureRedirectMask | PropertyChangeMask)
|
||||
|
||||
void
|
||||
ChangeNumberOfDesktops(int quantity)
|
||||
{
|
||||
|
@ -283,12 +288,7 @@ InitDesktopBgs(void)
|
|||
{
|
||||
d->win =
|
||||
ECreateWindow(root.win, -root.w, -root.h, root.w, root.h, 0);
|
||||
XSelectInput(disp, d->win,
|
||||
SubstructureNotifyMask | ButtonPressMask |
|
||||
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask
|
||||
| ButtonMotionMask | PropertyChangeMask |
|
||||
SubstructureRedirectMask | KeyPressMask |
|
||||
KeyReleaseMask | PointerMotionMask);
|
||||
XSelectInput(disp, d->win, EDESK_EVENT_MASK);
|
||||
}
|
||||
at = XInternAtom(disp, "ENLIGHTENMENT_DESKTOP", False);
|
||||
XChangeProperty(disp, d->win, at, XA_CARDINAL, 32, PropModeReplace,
|
||||
|
@ -1293,12 +1293,7 @@ DesktopsEventsConfigure(int mode)
|
|||
PropertyChangeMask | SubstructureRedirectMask |
|
||||
ButtonPressMask | ButtonReleaseMask;
|
||||
else
|
||||
event_mask =
|
||||
SubstructureNotifyMask | ButtonPressMask |
|
||||
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
|
||||
ButtonMotionMask | PropertyChangeMask |
|
||||
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask
|
||||
| PointerMotionMask;
|
||||
event_mask = EDESK_EVENT_MASK;
|
||||
|
||||
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
|
||||
XSelectInput(disp, desks.desk[i].win, event_mask);
|
||||
|
|
|
@ -685,11 +685,13 @@ ShowDialog(Dialog * d)
|
|||
|
||||
ewin = AddInternalToFamily(d->win, NULL, EWIN_TYPE_DIALOG, d,
|
||||
DialogEwinInit);
|
||||
XSelectInput(disp, d->win,
|
||||
ExposureMask | PointerMotionMask | EnterWindowMask |
|
||||
LeaveWindowMask | FocusChangeMask | KeyPressMask);
|
||||
if (ewin)
|
||||
{
|
||||
#if 0 /* Do we need this? */
|
||||
ewin->client.event_mask |=
|
||||
KeyPressMask | PointerMotionMask | ExposureMask;
|
||||
XSelectInput(disp, d->win, ewin->client.event_mask);
|
||||
#endif
|
||||
sn = FindSnapshot(ewin);
|
||||
/* get the size right damnit! */
|
||||
if (sn && sn->use_wh)
|
||||
|
|
|
@ -666,7 +666,7 @@ HandleDestroy(XEvent * ev)
|
|||
ewin = RemoveItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
|
||||
if (ewin)
|
||||
{
|
||||
EwinDestroy(ewin);
|
||||
EwinEventDestroy(ewin);
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
|
|
|
@ -392,19 +392,12 @@ ICCCM_Adopt(EWin * ewin)
|
|||
{
|
||||
Window win = ewin->client.win;
|
||||
unsigned long c[2] = { 0, 0 };
|
||||
XWindowAttributes att;
|
||||
|
||||
EDBUG(6, "ICCCM_Adopt");
|
||||
|
||||
if (!ewin->internal)
|
||||
XSetWindowBorderWidth(disp, win, 0);
|
||||
EReparentWindow(disp, win, ewin->win_container, 0, 0);
|
||||
XGetWindowAttributes(disp, win, &att);
|
||||
XSelectInput(disp, win,
|
||||
att.your_event_mask | PropertyChangeMask | EnterWindowMask |
|
||||
LeaveWindowMask | FocusChangeMask | ResizeRedirectMask |
|
||||
StructureNotifyMask | ColormapChangeMask);
|
||||
XShapeSelectInput(disp, win, ShapeNotifyMask);
|
||||
c[0] = (ewin->client.start_iconified) ? IconicState : NormalState;
|
||||
XChangeProperty(disp, win, E_XA_WM_STATE, E_XA_WM_STATE, 32, PropModeReplace,
|
||||
(unsigned char *)c, 2);
|
||||
|
|
|
@ -323,6 +323,11 @@ MenuShow(Menu * m, char noshow)
|
|||
MenuEwinInit);
|
||||
if (ewin)
|
||||
{
|
||||
#if 0 /* Do we need this? */
|
||||
ewin->client.event_mask |= PointerMotionMask;
|
||||
XSelectInput(disp, m->win, ewin->client.event_mask);
|
||||
#endif
|
||||
|
||||
ewin->head = head_num;
|
||||
if (Conf.menuslide)
|
||||
InstantShadeEwin(ewin, 0);
|
||||
|
@ -651,8 +656,6 @@ MenuRealize(Menu * m)
|
|||
maxx2 = 0;
|
||||
has_i = 0;
|
||||
has_s = 0;
|
||||
att.event_mask = PointerMotionMask;
|
||||
XChangeWindowAttributes(disp, m->win, CWEventMask, &att);
|
||||
att.event_mask =
|
||||
ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask
|
||||
| PointerMotionMask;
|
||||
|
|
|
@ -198,8 +198,6 @@ PagerCreate(void)
|
|||
p->pmap = ECreatePixmap(disp, p->win, p->w, p->h, root.depth);
|
||||
p->bgpmap = ECreatePixmap(disp, p->win, p->w / ax, p->h / ay, root.depth);
|
||||
ESetWindowBackgroundPixmap(disp, p->win, p->pmap);
|
||||
XSelectInput(disp, p->win,
|
||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
|
||||
p->hi_win = ECreateWindow(root.win, 0, 0, 3, 3, 0);
|
||||
p->hi_visible = 0;
|
||||
p->hi_ewin = NULL;
|
||||
|
@ -346,6 +344,12 @@ PagerShow(Pager * p)
|
|||
Snapshot *sn;
|
||||
double aspect;
|
||||
|
||||
#if 1 /* Do we need this? */
|
||||
ewin->client.event_mask |=
|
||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
|
||||
XSelectInput(disp, p->win, ewin->client.event_mask);
|
||||
#endif
|
||||
|
||||
aspect = ((double)root.w) / ((double)root.h);
|
||||
GetAreaSize(&ax, &ay);
|
||||
ewin->client.aspect_min = aspect * ((double)ax / (double)ay);
|
||||
|
|
Loading…
Reference in New Issue