remove the event dispatcher
This commit is contained in:
parent
1ce196c4f3
commit
3c5f6db04c
9 changed files with 54 additions and 471 deletions
|
@ -132,8 +132,6 @@ kernel_openbox_SOURCES = \
|
||||||
kernel/config.h \
|
kernel/config.h \
|
||||||
kernel/debug.c \
|
kernel/debug.c \
|
||||||
kernel/debug.h \
|
kernel/debug.h \
|
||||||
kernel/dispatch.c \
|
|
||||||
kernel/dispatch.h \
|
|
||||||
kernel/dock.c \
|
kernel/dock.c \
|
||||||
kernel/dock.h \
|
kernel/dock.h \
|
||||||
kernel/event.c \
|
kernel/event.c \
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "startup.h"
|
#include "startup.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "moveresize.h"
|
#include "moveresize.h"
|
||||||
|
#include "place.h"
|
||||||
#include "prop.h"
|
#include "prop.h"
|
||||||
#include "extensions.h"
|
#include "extensions.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
@ -13,7 +14,6 @@
|
||||||
#include "grab.h"
|
#include "grab.h"
|
||||||
#include "focus.h"
|
#include "focus.h"
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "dispatch.h"
|
|
||||||
#include "openbox.h"
|
#include "openbox.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -254,10 +254,10 @@ void client_manage(Window window)
|
||||||
|
|
||||||
frame_grab_client(self->frame, self);
|
frame_grab_client(self->frame, self);
|
||||||
|
|
||||||
client_apply_startup_state(self);
|
|
||||||
|
|
||||||
grab_server(FALSE);
|
grab_server(FALSE);
|
||||||
|
|
||||||
|
client_apply_startup_state(self);
|
||||||
|
|
||||||
/* update the focus lists */
|
/* update the focus lists */
|
||||||
focus_order_add_new(self);
|
focus_order_add_new(self);
|
||||||
|
|
||||||
|
@ -306,10 +306,24 @@ void client_manage(Window window)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch_client(Event_Client_New, self, 0, 0);
|
if (ob_state() == OB_STATE_RUNNING) {
|
||||||
|
int x = self->area.x, ox = x;
|
||||||
|
int y = self->area.y, oy = y;
|
||||||
|
|
||||||
|
place_client(self, &x, &y);
|
||||||
|
|
||||||
|
client_find_onscreen(self, &x, &y,
|
||||||
|
self->frame->area.width,
|
||||||
|
self->frame->area.height,
|
||||||
|
client_normal(self));
|
||||||
|
|
||||||
|
if (x != ox || y != oy)
|
||||||
|
client_configure(self, OB_CORNER_TOPLEFT, x, y,
|
||||||
|
self->area.width, self->area.height,
|
||||||
|
TRUE, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* make sure the window is visible */
|
/* make sure the window is visible */
|
||||||
if (ob_state() == OB_STATE_RUNNING)
|
|
||||||
client_move_onscreen(self, client_normal(self));
|
client_move_onscreen(self, client_normal(self));
|
||||||
|
|
||||||
client_showhide(self);
|
client_showhide(self);
|
||||||
|
@ -339,8 +353,6 @@ void client_manage(Window window)
|
||||||
keyboard_grab_for_client(self, TRUE);
|
keyboard_grab_for_client(self, TRUE);
|
||||||
mouse_grab_for_client(self, TRUE);
|
mouse_grab_for_client(self, TRUE);
|
||||||
|
|
||||||
dispatch_client(Event_Client_Mapped, self, 0, 0);
|
|
||||||
|
|
||||||
ob_debug("Managed window 0x%lx (%s)\n", window, self->class);
|
ob_debug("Managed window 0x%lx (%s)\n", window, self->class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +369,6 @@ void client_unmanage(ObClient *self)
|
||||||
|
|
||||||
ob_debug("Unmanaging window: %lx (%s)\n", self->window, self->class);
|
ob_debug("Unmanaging window: %lx (%s)\n", self->window, self->class);
|
||||||
|
|
||||||
dispatch_client(Event_Client_Destroy, self, 0, 0);
|
|
||||||
g_assert(self != NULL);
|
g_assert(self != NULL);
|
||||||
|
|
||||||
keyboard_grab_for_client(self, FALSE);
|
keyboard_grab_for_client(self, FALSE);
|
||||||
|
@ -425,10 +436,6 @@ void client_unmanage(ObClient *self)
|
||||||
self->group = NULL;
|
self->group = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dispatch the unmapped event */
|
|
||||||
dispatch_client(Event_Client_Unmapped, self, 0, 0);
|
|
||||||
g_assert(self != NULL);
|
|
||||||
|
|
||||||
/* give the client its border back */
|
/* give the client its border back */
|
||||||
client_toggle_border(self, TRUE);
|
client_toggle_border(self, TRUE);
|
||||||
|
|
||||||
|
@ -1280,8 +1287,9 @@ void client_update_wmhints(ObClient *self)
|
||||||
ur ? "ON" : "OFF");
|
ur ? "ON" : "OFF");
|
||||||
/* fire the urgent callback if we're mapped, otherwise, wait until
|
/* fire the urgent callback if we're mapped, otherwise, wait until
|
||||||
after we're mapped */
|
after we're mapped */
|
||||||
if (self->frame)
|
if (self->frame) {
|
||||||
dispatch_client(Event_Client_Urgent, self, self->urgent, 0);
|
/* XXX do shit */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1705,7 +1713,7 @@ static void client_apply_startup_state(ObClient *self)
|
||||||
client_shade(self, TRUE);
|
client_shade(self, TRUE);
|
||||||
}
|
}
|
||||||
if (self->urgent)
|
if (self->urgent)
|
||||||
dispatch_client(Event_Client_Urgent, self, self->urgent, 0);
|
/* XXX do shit */;
|
||||||
|
|
||||||
if (self->max_vert && self->max_horz) {
|
if (self->max_vert && self->max_horz) {
|
||||||
self->max_vert = self->max_horz = FALSE;
|
self->max_vert = self->max_horz = FALSE;
|
||||||
|
@ -2062,9 +2070,6 @@ static void client_iconify_recursive(ObClient *self,
|
||||||
client_change_state(self);
|
client_change_state(self);
|
||||||
client_showhide(self);
|
client_showhide(self);
|
||||||
screen_update_areas();
|
screen_update_areas();
|
||||||
|
|
||||||
dispatch_client(iconic ? Event_Client_Unmapped : Event_Client_Mapped,
|
|
||||||
self, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* iconify all transients */
|
/* iconify all transients */
|
||||||
|
@ -2266,8 +2271,6 @@ void client_set_desktop_recursive(ObClient *self,
|
||||||
focus_order_to_top(self);
|
focus_order_to_top(self);
|
||||||
else
|
else
|
||||||
focus_order_to_bottom(self);
|
focus_order_to_bottom(self);
|
||||||
|
|
||||||
dispatch_client(Event_Client_Desktop, self, target, old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move all transients */
|
/* move all transients */
|
||||||
|
|
|
@ -1,268 +0,0 @@
|
||||||
#include "dispatch.h"
|
|
||||||
#include "extensions.h"
|
|
||||||
#include "client.h"
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
EventHandler h;
|
|
||||||
void *data;
|
|
||||||
} Func;
|
|
||||||
|
|
||||||
/* an array of GSList*s of Func*s */
|
|
||||||
static GSList **funcs;
|
|
||||||
|
|
||||||
void dispatch_startup()
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
EventType j;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
j = EVENT_RANGE;
|
|
||||||
while (j > 1) {
|
|
||||||
j >>= 1;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
funcs = g_new0(GSList*, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispatch_shutdown()
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
EventType j;
|
|
||||||
GSList *it;
|
|
||||||
|
|
||||||
for (i = 0, j = 1; j < EVENT_RANGE; ++i, j <<= 1) {
|
|
||||||
for (it = funcs[i]; it != NULL; it = it->next)
|
|
||||||
g_free(it->data);
|
|
||||||
g_slist_free(funcs[i]);
|
|
||||||
funcs[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(funcs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispatch_register(EventMask mask, EventHandler h, void *data)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
EventType j;
|
|
||||||
GSList *it, *next;
|
|
||||||
EventMask m;
|
|
||||||
Func *f;
|
|
||||||
|
|
||||||
/* add to masks it needs to be registered for */
|
|
||||||
m = mask;
|
|
||||||
while (m) {
|
|
||||||
for (i = 0, j = 1; j < EVENT_RANGE; ++i, j <<= 1)
|
|
||||||
if (m & j) {
|
|
||||||
for (it = funcs[i]; it != NULL; it = it->next) {
|
|
||||||
f = it->data;
|
|
||||||
if (f->h == h && f->data == data)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (it == NULL) { /* wasn't already regged */
|
|
||||||
f = g_new(Func, 1);
|
|
||||||
f->h = h;
|
|
||||||
f->data = data;
|
|
||||||
funcs[i] = g_slist_append(funcs[i], f);
|
|
||||||
}
|
|
||||||
m ^= j; /* remove from the mask */
|
|
||||||
}
|
|
||||||
g_assert(j >= EVENT_RANGE); /* an invalid event is in the mask */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove from masks its not registered for anymore */
|
|
||||||
for (i = 0, j = 1; j < EVENT_RANGE; ++i, j <<= 1) {
|
|
||||||
if (!(j & mask))
|
|
||||||
for (it = funcs[i]; it != NULL; it = next) {
|
|
||||||
next = it->next;
|
|
||||||
f = it->data;
|
|
||||||
if (f->h == h && f->data == data) {
|
|
||||||
g_free(f);
|
|
||||||
funcs[i] = g_slist_delete_link(funcs[i], it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispatch_x(XEvent *xe, ObClient *c)
|
|
||||||
{
|
|
||||||
EventType e;
|
|
||||||
guint i;
|
|
||||||
GSList *it;
|
|
||||||
ObEvent obe;
|
|
||||||
|
|
||||||
switch (xe->type) {
|
|
||||||
case EnterNotify:
|
|
||||||
e = Event_X_EnterNotify;
|
|
||||||
break;
|
|
||||||
case LeaveNotify:
|
|
||||||
e = Event_X_LeaveNotify;
|
|
||||||
break;
|
|
||||||
case KeyPress:
|
|
||||||
e = Event_X_KeyPress;
|
|
||||||
break;
|
|
||||||
case KeyRelease:
|
|
||||||
e = Event_X_KeyRelease;
|
|
||||||
break;
|
|
||||||
case ButtonPress:
|
|
||||||
e = Event_X_ButtonPress;
|
|
||||||
break;
|
|
||||||
case ButtonRelease:
|
|
||||||
e = Event_X_ButtonRelease;
|
|
||||||
break;
|
|
||||||
case MotionNotify:
|
|
||||||
e = Event_X_MotionNotify;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* XKB events */
|
|
||||||
if (xe->type == extensions_xkb_event_basep) {
|
|
||||||
switch (((XkbAnyEvent*)&e)->xkb_type) {
|
|
||||||
case XkbBellNotify:
|
|
||||||
e = Event_X_Bell;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
obe.type = e;
|
|
||||||
obe.data.x.e = xe;
|
|
||||||
obe.data.x.client = c;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (e > 1) {
|
|
||||||
e >>= 1;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (it = funcs[i]; it != NULL; it = it->next) {
|
|
||||||
Func *f = it->data;
|
|
||||||
f->h(&obe, f->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispatch_client(EventType e, ObClient *c, int num0, int num1)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
GSList *it;
|
|
||||||
ObEvent obe;
|
|
||||||
|
|
||||||
g_assert(c != NULL);
|
|
||||||
|
|
||||||
obe.type = e;
|
|
||||||
obe.data.c.client = c;
|
|
||||||
obe.data.c.num[0] = num0;
|
|
||||||
obe.data.c.num[1] = num1;
|
|
||||||
obe.data.c.num[2] = 0;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (e > 1) {
|
|
||||||
e >>= 1;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (it = funcs[i]; it != NULL; it = it->next) {
|
|
||||||
Func *f = it->data;
|
|
||||||
f->h(&obe, f->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispatch_ob(EventType e, int num0, int num1)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
GSList *it;
|
|
||||||
ObEvent obe;
|
|
||||||
|
|
||||||
obe.type = e;
|
|
||||||
obe.data.o.num[0] = num0;
|
|
||||||
obe.data.o.num[1] = num1;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (e > 1) {
|
|
||||||
e >>= 1;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (it = funcs[i]; it != NULL; it = it->next) {
|
|
||||||
Func *f = it->data;
|
|
||||||
f->h(&obe, f->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispatch_signal(int signal)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
EventType e = Event_Signal;
|
|
||||||
GSList *it;
|
|
||||||
ObEvent obe;
|
|
||||||
|
|
||||||
obe.type = e;
|
|
||||||
obe.data.s.signal = signal;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (e > 1) {
|
|
||||||
e >>= 1;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (it = funcs[i]; it != NULL; it = it->next) {
|
|
||||||
Func *f = it->data;
|
|
||||||
f->h(&obe, f->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispatch_move(ObClient *c, int *x, int *y)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
GSList *it;
|
|
||||||
EventType e = Event_Client_Moving;
|
|
||||||
ObEvent obe;
|
|
||||||
|
|
||||||
obe.type = e;
|
|
||||||
obe.data.c.client = c;
|
|
||||||
obe.data.c.num[0] = *x;
|
|
||||||
obe.data.c.num[1] = *y;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (e > 1) {
|
|
||||||
e >>= 1;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (it = funcs[i]; it != NULL; it = it->next) {
|
|
||||||
Func *f = it->data;
|
|
||||||
f->h(&obe, f->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
*x = obe.data.c.num[0];
|
|
||||||
*y = obe.data.c.num[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispatch_resize(ObClient *c, int *w, int *h, ObCorner corner)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
GSList *it;
|
|
||||||
EventType e = Event_Client_Resizing;
|
|
||||||
ObEvent obe;
|
|
||||||
|
|
||||||
obe.type = e;
|
|
||||||
obe.data.c.client = c;
|
|
||||||
obe.data.c.num[0] = *w;
|
|
||||||
obe.data.c.num[1] = *h;
|
|
||||||
obe.data.c.num[2] = corner;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (e > 1) {
|
|
||||||
e >>= 1;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (it = funcs[i]; it != NULL; it = it->next) {
|
|
||||||
Func *f = it->data;
|
|
||||||
f->h(&obe, f->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
*w = obe.data.c.num[0];
|
|
||||||
*h = obe.data.c.num[1];
|
|
||||||
}
|
|
|
@ -1,106 +0,0 @@
|
||||||
#ifndef __dispatch_h
|
|
||||||
#define __dispatch_h
|
|
||||||
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
|
|
||||||
struct _ObClient;
|
|
||||||
|
|
||||||
void dispatch_startup();
|
|
||||||
void dispatch_shutdown();
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
Event_X_EnterNotify = 1 << 0, /* pointer entered a window */
|
|
||||||
Event_X_LeaveNotify = 1 << 1, /* pointer left a window */
|
|
||||||
Event_X_KeyPress = 1 << 2, /* key pressed */
|
|
||||||
Event_X_KeyRelease = 1 << 3, /* key released */
|
|
||||||
Event_X_ButtonPress = 1 << 4, /* mouse button pressed */
|
|
||||||
Event_X_ButtonRelease = 1 << 5, /* mouse button released */
|
|
||||||
Event_X_MotionNotify = 1 << 6, /* mouse motion */
|
|
||||||
Event_X_Bell = 1 << 7, /* an XKB bell event */
|
|
||||||
|
|
||||||
Event_Client_New = 1 << 8, /* new window, before mapping */
|
|
||||||
Event_Client_Mapped = 1 << 9, /* new window, after mapping
|
|
||||||
or uniconified */
|
|
||||||
Event_Client_Destroy = 1 << 10, /* unmanaged */
|
|
||||||
Event_Client_Unmapped = 1 << 11, /* unmanaged, after unmapping
|
|
||||||
or iconified */
|
|
||||||
Event_Client_Focus = 1 << 12, /* focused */
|
|
||||||
Event_Client_Unfocus = 1 << 13, /* unfocused */
|
|
||||||
Event_Client_Urgent = 1 << 14, /* entered/left urgent state */
|
|
||||||
Event_Client_Desktop = 1 << 15, /* moved to a new desktop */
|
|
||||||
Event_Client_Moving = 1 << 16, /* being interactively moved */
|
|
||||||
Event_Client_Resizing = 1 << 17, /* being interactively resized */
|
|
||||||
|
|
||||||
Event_Ob_Desktop = 1 << 18, /* changed desktops */
|
|
||||||
Event_Ob_NumDesktops = 1 << 19, /* changed the number of desktops */
|
|
||||||
Event_Ob_ShowDesktop = 1 << 20, /* entered/left show-the-desktop mode */
|
|
||||||
|
|
||||||
Event_Signal = 1 << 21, /* a signal from the OS */
|
|
||||||
|
|
||||||
EVENT_RANGE = 1 << 22
|
|
||||||
} EventType;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
XEvent *e;
|
|
||||||
struct _ObClient *client;
|
|
||||||
} EventData_X;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
struct _ObClient *client;
|
|
||||||
int num[3];
|
|
||||||
/* Event_Client_Desktop: num[0] = new number, num[1] = old number
|
|
||||||
Event_Client_Urgent: num[0] = urgent state
|
|
||||||
Event_Client_Moving: num[0] = dest x coord, num[1] = dest y coord --
|
|
||||||
change these in the handler to adjust where the
|
|
||||||
window will be placed
|
|
||||||
Event_Client_Resizing: num[0] = dest width, num[1] = dest height --
|
|
||||||
change these in the handler to adjust where the
|
|
||||||
window will be placed
|
|
||||||
num[2] = the anchored corner
|
|
||||||
*/
|
|
||||||
} EventData_Client;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int num[2];
|
|
||||||
/* Event_Ob_Desktop: num[0] = new number, num[1] = old number
|
|
||||||
Event_Ob_NumDesktops: num[0] = new number, num[1] = old number
|
|
||||||
Event_Ob_ShowDesktop: num[0] = new show-desktop mode
|
|
||||||
*/
|
|
||||||
} EventData_Ob;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int signal;
|
|
||||||
} EventData_Signal;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
EventData_X x; /* for Event_X_* event types */
|
|
||||||
EventData_Client c; /* for Event_ObClient_* event types */
|
|
||||||
EventData_Ob o; /* for Event_Ob_* event types */
|
|
||||||
EventData_Signal s; /* for Event_Signal */
|
|
||||||
} EventData;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
EventType type;
|
|
||||||
EventData data;
|
|
||||||
} ObEvent;
|
|
||||||
|
|
||||||
typedef void (*EventHandler)(const ObEvent *e, void *data);
|
|
||||||
|
|
||||||
typedef unsigned int EventMask;
|
|
||||||
|
|
||||||
void dispatch_register(EventMask mask, EventHandler h, void *data);
|
|
||||||
|
|
||||||
void dispatch_x(XEvent *e, struct _ObClient *c);
|
|
||||||
void dispatch_client(EventType e, struct _ObClient *c, int num0, int num1);
|
|
||||||
void dispatch_ob(EventType e, int num0, int num1);
|
|
||||||
void dispatch_signal(int signal);
|
|
||||||
/* *x and *y should be set with the destination of the window, they may be
|
|
||||||
changed by the event handlers */
|
|
||||||
void dispatch_move(struct _ObClient *c, int *x, int *y);
|
|
||||||
/* *w and *h should be set with the destination of the window, they may be
|
|
||||||
changed by the event handlers */
|
|
||||||
void dispatch_resize(struct _ObClient *c, int *w, int *h, ObCorner corner);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "extensions.h"
|
#include "extensions.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "dispatch.h"
|
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
@ -523,35 +522,21 @@ static void event_process(XEvent *e)
|
||||||
xerror_set_ignore(FALSE);
|
xerror_set_ignore(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_frame_visible)
|
|
||||||
if (e->type == MotionNotify || e->type == ButtonRelease ||
|
|
||||||
e->type == ButtonPress ||
|
|
||||||
e->type == KeyPress || e->type == KeyRelease) {
|
|
||||||
event_handle_menu(e);
|
|
||||||
|
|
||||||
return; /* no dispatch! */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (moveresize_in_progress)
|
|
||||||
if (e->type == MotionNotify || e->type == ButtonRelease ||
|
|
||||||
e->type == ButtonPress ||
|
|
||||||
e->type == KeyPress || e->type == KeyRelease) {
|
|
||||||
moveresize_event(e);
|
|
||||||
|
|
||||||
return; /* no dispatch! */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* user input (action-bound) events */
|
/* user input (action-bound) events */
|
||||||
if (e->type == ButtonPress || e->type == ButtonRelease ||
|
if (e->type == ButtonPress || e->type == ButtonRelease ||
|
||||||
e->type == MotionNotify || e->type == KeyPress ||
|
e->type == MotionNotify || e->type == KeyPress ||
|
||||||
e->type == KeyRelease)
|
e->type == KeyRelease)
|
||||||
{
|
{
|
||||||
|
if (menu_frame_visible)
|
||||||
|
event_handle_menu(e);
|
||||||
|
else if (moveresize_in_progress)
|
||||||
|
moveresize_event(e);
|
||||||
|
else {
|
||||||
ObFrameContext context;
|
ObFrameContext context;
|
||||||
|
|
||||||
context = frame_context(client, e->xany.window);
|
context = frame_context(client, e->xany.window);
|
||||||
|
|
||||||
if (!keyboard_process_interactive_grab(e, &client, &context)) {
|
if (!keyboard_process_interactive_grab(e, &client, &context)) {
|
||||||
|
|
||||||
if (e->type == ButtonPress || e->type == ButtonRelease ||
|
if (e->type == ButtonPress || e->type == ButtonRelease ||
|
||||||
e->type == MotionNotify)
|
e->type == MotionNotify)
|
||||||
mouse_event(client, context, e);
|
mouse_event(client, context, e);
|
||||||
|
@ -559,9 +544,7 @@ static void event_process(XEvent *e)
|
||||||
keyboard_event(client, e);
|
keyboard_event(client, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* dispatch the event to registered handlers */
|
|
||||||
dispatch_x(e, client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void event_handle_root(XEvent *e)
|
static void event_handle_root(XEvent *e)
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "prop.h"
|
#include "prop.h"
|
||||||
#include "dispatch.h"
|
|
||||||
#include "focus.h"
|
#include "focus.h"
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "popup.h"
|
#include "popup.h"
|
||||||
|
@ -96,11 +95,6 @@ void focus_set_client(ObClient *client)
|
||||||
PROP_SET32(RootWindow(ob_display, ob_screen),
|
PROP_SET32(RootWindow(ob_display, ob_screen),
|
||||||
net_active_window, window, active);
|
net_active_window, window, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (focus_client != NULL)
|
|
||||||
dispatch_client(Event_Client_Focus, focus_client, 0, 0);
|
|
||||||
if (old != NULL)
|
|
||||||
dispatch_client(Event_Client_Unfocus, old, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean focus_under_pointer()
|
static gboolean focus_under_pointer()
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "prop.h"
|
#include "prop.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "dispatch.h"
|
|
||||||
#include "openbox.h"
|
#include "openbox.h"
|
||||||
#include "resist.h"
|
#include "resist.h"
|
||||||
#include "popup.h"
|
#include "popup.h"
|
||||||
|
@ -157,8 +156,6 @@ static void do_move(gboolean resist)
|
||||||
if (resist)
|
if (resist)
|
||||||
resist_move(moveresize_client, &cur_x, &cur_y);
|
resist_move(moveresize_client, &cur_x, &cur_y);
|
||||||
|
|
||||||
dispatch_move(moveresize_client, &cur_x, &cur_y);
|
|
||||||
|
|
||||||
/* get where the client should be */
|
/* get where the client should be */
|
||||||
frame_frame_gravity(moveresize_client->frame, &cur_x, &cur_y);
|
frame_frame_gravity(moveresize_client->frame, &cur_x, &cur_y);
|
||||||
client_configure(moveresize_client, OB_CORNER_TOPLEFT, cur_x, cur_y,
|
client_configure(moveresize_client, OB_CORNER_TOPLEFT, cur_x, cur_y,
|
||||||
|
@ -174,21 +171,20 @@ static void do_move(gboolean resist)
|
||||||
|
|
||||||
static void do_resize(gboolean resist)
|
static void do_resize(gboolean resist)
|
||||||
{
|
{
|
||||||
/* dispatch_resize needs the frame size */
|
if (resist) {
|
||||||
|
/* resist_size needs the frame size */
|
||||||
cur_x += moveresize_client->frame->size.left +
|
cur_x += moveresize_client->frame->size.left +
|
||||||
moveresize_client->frame->size.right;
|
moveresize_client->frame->size.right;
|
||||||
cur_y += moveresize_client->frame->size.top +
|
cur_y += moveresize_client->frame->size.top +
|
||||||
moveresize_client->frame->size.bottom;
|
moveresize_client->frame->size.bottom;
|
||||||
|
|
||||||
if (resist)
|
|
||||||
resist_size(moveresize_client, &cur_x, &cur_y, lockcorner);
|
resist_size(moveresize_client, &cur_x, &cur_y, lockcorner);
|
||||||
|
|
||||||
dispatch_resize(moveresize_client, &cur_x, &cur_y, lockcorner);
|
|
||||||
|
|
||||||
cur_x -= moveresize_client->frame->size.left +
|
cur_x -= moveresize_client->frame->size.left +
|
||||||
moveresize_client->frame->size.right;
|
moveresize_client->frame->size.right;
|
||||||
cur_y -= moveresize_client->frame->size.top +
|
cur_y -= moveresize_client->frame->size.top +
|
||||||
moveresize_client->frame->size.bottom;
|
moveresize_client->frame->size.bottom;
|
||||||
|
}
|
||||||
|
|
||||||
client_configure(moveresize_client, lockcorner,
|
client_configure(moveresize_client, lockcorner,
|
||||||
moveresize_client->area.x, moveresize_client->area.y,
|
moveresize_client->area.x, moveresize_client->area.y,
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "dispatch.h"
|
|
||||||
#include "xerror.h"
|
#include "xerror.h"
|
||||||
#include "prop.h"
|
#include "prop.h"
|
||||||
#include "startup.h"
|
#include "startup.h"
|
||||||
|
@ -66,7 +65,7 @@ static Cursor cursors[OB_NUM_CURSORS];
|
||||||
static KeyCode keys[OB_NUM_KEYS];
|
static KeyCode keys[OB_NUM_KEYS];
|
||||||
static gchar *sm_save_file;
|
static gchar *sm_save_file;
|
||||||
|
|
||||||
static void signal_handler(const ObEvent *e, void *data);
|
static void signal_handler(int signal);
|
||||||
static void parse_args(int argc, char **argv);
|
static void parse_args(int argc, char **argv);
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
@ -90,13 +89,9 @@ int main(int argc, char **argv)
|
||||||
bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
|
bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
|
||||||
textdomain(PACKAGE_NAME);
|
textdomain(PACKAGE_NAME);
|
||||||
|
|
||||||
/* start our event dispatcher and register for signals */
|
|
||||||
dispatch_startup();
|
|
||||||
dispatch_register(Event_Signal, signal_handler, NULL);
|
|
||||||
|
|
||||||
/* set up signal handler */
|
/* set up signal handler */
|
||||||
sigemptyset(&sigset);
|
sigemptyset(&sigset);
|
||||||
action.sa_handler = dispatch_signal;
|
action.sa_handler = signal_handler;
|
||||||
action.sa_mask = sigset;
|
action.sa_mask = sigset;
|
||||||
action.sa_flags = SA_NOCLDSTOP | SA_NODEFER;
|
action.sa_flags = SA_NOCLDSTOP | SA_NODEFER;
|
||||||
sigaction(SIGUSR1, &action, (struct sigaction *) NULL);
|
sigaction(SIGUSR1, &action, (struct sigaction *) NULL);
|
||||||
|
@ -284,8 +279,6 @@ int main(int argc, char **argv)
|
||||||
config_shutdown();
|
config_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch_shutdown();
|
|
||||||
|
|
||||||
RrThemeFree(ob_rr_theme);
|
RrThemeFree(ob_rr_theme);
|
||||||
RrInstanceFree(ob_rr_inst);
|
RrInstanceFree(ob_rr_inst);
|
||||||
|
|
||||||
|
@ -321,12 +314,9 @@ int main(int argc, char **argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void signal_handler(const ObEvent *e, void *data)
|
static void signal_handler(int sig)
|
||||||
{
|
{
|
||||||
int s;
|
switch (sig) {
|
||||||
|
|
||||||
s = e->data.s.signal;
|
|
||||||
switch (s) {
|
|
||||||
case SIGUSR1:
|
case SIGUSR1:
|
||||||
fprintf(stderr, "Caught SIGUSR1 signal. Restarting.");
|
fprintf(stderr, "Caught SIGUSR1 signal. Restarting.");
|
||||||
ob_restart();
|
ob_restart();
|
||||||
|
@ -336,13 +326,13 @@ static void signal_handler(const ObEvent *e, void *data)
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
case SIGPIPE:
|
case SIGPIPE:
|
||||||
fprintf(stderr, "Caught signal %d. Exiting.", s);
|
fprintf(stderr, "Caught signal %d. Exiting.", sig);
|
||||||
ob_exit();
|
ob_exit();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
fprintf(stderr, "Caught signal %d. Aborting and dumping core.", s);
|
fprintf(stderr, "Caught signal %d. Aborting and dumping core.", sig);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "focus.h"
|
#include "focus.h"
|
||||||
#include "popup.h"
|
#include "popup.h"
|
||||||
#include "dispatch.h"
|
|
||||||
#include "extensions.h"
|
#include "extensions.h"
|
||||||
#include "render/render.h"
|
#include "render/render.h"
|
||||||
|
|
||||||
|
@ -402,8 +401,6 @@ void screen_set_num_desktops(guint num)
|
||||||
/* change our struts/area to match (after moving windows) */
|
/* change our struts/area to match (after moving windows) */
|
||||||
screen_update_areas();
|
screen_update_areas();
|
||||||
|
|
||||||
dispatch_ob(Event_Ob_NumDesktops, num, old);
|
|
||||||
|
|
||||||
/* change our desktop if we're on one that no longer exists! */
|
/* change our desktop if we're on one that no longer exists! */
|
||||||
if (screen_desktop >= screen_num_desktops)
|
if (screen_desktop >= screen_num_desktops)
|
||||||
screen_set_desktop(num - 1);
|
screen_set_desktop(num - 1);
|
||||||
|
@ -456,8 +453,6 @@ void screen_set_desktop(guint num)
|
||||||
#ifdef DEBUG_FOCUS
|
#ifdef DEBUG_FOCUS
|
||||||
ob_debug("/switch fallback\n");
|
ob_debug("/switch fallback\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dispatch_ob(Event_Ob_Desktop, num, old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_row_col(guint d, guint *r, guint *c)
|
static void get_row_col(guint d, guint *r, guint *c)
|
||||||
|
@ -847,8 +842,6 @@ void screen_show_desktop(gboolean show)
|
||||||
show = !!show; /* make it boolean */
|
show = !!show; /* make it boolean */
|
||||||
PROP_SET32(RootWindow(ob_display, ob_screen),
|
PROP_SET32(RootWindow(ob_display, ob_screen),
|
||||||
net_showing_desktop, cardinal, show);
|
net_showing_desktop, cardinal, show);
|
||||||
|
|
||||||
dispatch_ob(Event_Ob_ShowDesktop, show, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void screen_install_colormap(ObClient *client, gboolean install)
|
void screen_install_colormap(ObClient *client, gboolean install)
|
||||||
|
|
Loading…
Reference in a new issue