use the dispatch stuff to get mouse button events
This commit is contained in:
parent
8886f1109d
commit
b8de0b48fd
1 changed files with 22 additions and 22 deletions
|
@ -2,6 +2,7 @@
|
|||
#include "../../kernel/openbox.h"
|
||||
#include "../../kernel/screen.h"
|
||||
#include "../../kernel/extensions.h"
|
||||
#include "../../kernel/dispatch.h"
|
||||
#include "../../kernel/themerc.h"
|
||||
#include "../../kernel/frame.h"
|
||||
#include "../../render/render.h"
|
||||
|
@ -126,6 +127,9 @@ static void render_iconify(ObFrame *self);
|
|||
static void render_desk(ObFrame *self);
|
||||
static void render_close(ObFrame *self);
|
||||
|
||||
static void frame_mouse_press(const ObEvent *e, ObFrame *self);
|
||||
static void frame_mouse_release(const ObEvent *e, ObFrame *self);
|
||||
|
||||
gboolean startup()
|
||||
{
|
||||
g_quark_from_string("none");
|
||||
|
@ -314,6 +318,11 @@ Frame *frame_new()
|
|||
self->max_press = self->close_press = self->desk_press =
|
||||
self->iconify_press = FALSE;
|
||||
|
||||
dispatch_register(Event_X_ButtonPress, (EventHandler)frame_mouse_press,
|
||||
self);
|
||||
dispatch_register(Event_X_ButtonRelease, (EventHandler)frame_mouse_release,
|
||||
self);
|
||||
|
||||
return (Frame*)self;
|
||||
}
|
||||
|
||||
|
@ -329,6 +338,9 @@ static void frame_free(ObFrame *self)
|
|||
|
||||
XDestroyWindow(ob_display, self->frame.window);
|
||||
|
||||
dispatch_register(0, (EventHandler)frame_mouse_press, self);
|
||||
dispatch_register(0, (EventHandler)frame_mouse_release, self);
|
||||
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
|
@ -867,49 +879,37 @@ GQuark get_context(Client *client, Window win)
|
|||
return g_quark_try_string("none");
|
||||
}
|
||||
|
||||
void frame_mouse_enter(ObFrame *self, Window win)
|
||||
{
|
||||
}
|
||||
|
||||
void frame_mouse_leave(ObFrame *self, Window win)
|
||||
{
|
||||
}
|
||||
|
||||
void frame_mouse_press(ObFrame *self, Window win, int x, int y)
|
||||
static void frame_mouse_press(const ObEvent *e, ObFrame *self)
|
||||
{
|
||||
Window win = e->data.x.e->xbutton.window;
|
||||
if (win == self->max) {
|
||||
self->max_press = TRUE;
|
||||
render_max(self);
|
||||
}
|
||||
else if (win == self->close) {
|
||||
} else if (win == self->close) {
|
||||
self->close_press = TRUE;
|
||||
render_close(self);
|
||||
}
|
||||
else if (win == self->iconify) {
|
||||
} else if (win == self->iconify) {
|
||||
self->iconify_press = TRUE;
|
||||
render_iconify(self);
|
||||
}
|
||||
else if (win == self->desk) {
|
||||
} else if (win == self->desk) {
|
||||
self->desk_press = TRUE;
|
||||
render_desk(self);
|
||||
}
|
||||
}
|
||||
|
||||
void frame_mouse_release(ObFrame *self, Window win, int x, int y)
|
||||
static void frame_mouse_release(const ObEvent *e, ObFrame *self)
|
||||
{
|
||||
Window win = e->data.x.e->xbutton.window;
|
||||
if (win == self->max) {
|
||||
self->max_press = FALSE;
|
||||
render_max(self);
|
||||
}
|
||||
else if (win == self->close) {
|
||||
} else if (win == self->close) {
|
||||
self->close_press = FALSE;
|
||||
render_close(self);
|
||||
}
|
||||
else if (win == self->iconify) {
|
||||
} else if (win == self->iconify) {
|
||||
self->iconify_press = FALSE;
|
||||
render_iconify(self);
|
||||
}
|
||||
else if (win == self->desk) {
|
||||
} else if (win == self->desk) {
|
||||
self->desk_press = FALSE;
|
||||
render_desk(self);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue