movemouse() is now an uicb function

This commit is contained in:
Julien Danjou 2007-11-12 14:02:52 +01:00
parent ef7034b0b8
commit f72c1bb54c
3 changed files with 18 additions and 11 deletions

View File

@ -33,6 +33,7 @@
#include "event.h" #include "event.h"
#include "tag.h" #include "tag.h"
#include "statusbar.h" #include "statusbar.h"
#include "event.h"
#include "layout.h" #include "layout.h"
#include "layouts/tile.h" #include "layouts/tile.h"
#include "layouts/floating.h" #include "layouts/floating.h"
@ -101,6 +102,8 @@ const NameFuncLink UicbList[] = {
/* config.c */ /* config.c */
{"reloadconfig", uicb_reloadconfig}, {"reloadconfig", uicb_reloadconfig},
{"setstatustext", uicb_setstatustext}, {"setstatustext", uicb_setstatustext},
/* event.c */
{"movemouse", uicb_movemouse},
{NULL, NULL} {NULL, NULL}
}; };

24
event.c
View File

@ -39,14 +39,24 @@
#define CLEANMASK(mask, screen) (mask & ~(awesomeconf[screen].numlockmask | LockMask)) #define CLEANMASK(mask, screen) (mask & ~(awesomeconf[screen].numlockmask | LockMask))
#define MOUSEMASK (BUTTONMASK | PointerMotionMask) #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
static void void
movemouse(Client *c, awesome_config *awesomeconf) uicb_movemouse(awesome_config *awesomeconf, const char *arg __attribute__ ((unused)))
{ {
int x1, y1, ocx, ocy, di, nx, ny; int x1, y1, ocx, ocy, di, nx, ny;
unsigned int dui; unsigned int dui;
Window dummy; Window dummy;
XEvent ev; XEvent ev;
ScreenInfo *si; ScreenInfo *si;
Client *c = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!c)
return;
if((get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange != layout_floating)
&& !c->isfloating)
uicb_togglefloating(&awesomeconf[c->screen], "DUMMY");
else
restack(awesomeconf);
si = get_screen_info(c->display, c->screen, &awesomeconf[c->screen].statusbar); si = get_screen_info(c->display, c->screen, &awesomeconf[c->screen].statusbar);
@ -215,15 +225,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
} }
} }
else if(ev->button == Button1) else if(ev->button == Button1)
{ uicb_movemouse(&awesomeconf[c->screen], NULL);
if((get_current_layout(awesomeconf[c->screen].tags,
awesomeconf[c->screen].ntags)->arrange != layout_floating)
&& !c->isfloating)
uicb_togglefloating(&awesomeconf[c->screen], "DUMMY");
else
restack(&awesomeconf[c->screen]);
movemouse(c, awesomeconf);
}
else if(ev->button == Button2) else if(ev->button == Button2)
{ {
if((get_current_layout(awesomeconf[c->screen].tags, if((get_current_layout(awesomeconf[c->screen].tags,

View File

@ -41,5 +41,7 @@ void handle_event_unmapnotify(XEvent *, awesome_config *);
void handle_event_shape(XEvent *, awesome_config *); void handle_event_shape(XEvent *, awesome_config *);
void handle_event_randr_screen_change_notify(XEvent *, awesome_config *); void handle_event_randr_screen_change_notify(XEvent *, awesome_config *);
UICB_PROTO(uicb_movemouse);
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99