From f72c1bb54cc237bf7c625360acda915af5f6404d Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 12 Nov 2007 14:02:52 +0100 Subject: [PATCH] movemouse() is now an uicb function --- config.c | 3 +++ event.c | 24 +++++++++++++----------- event.h | 2 ++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/config.c b/config.c index e4f4169eb..6da16eebc 100644 --- a/config.c +++ b/config.c @@ -33,6 +33,7 @@ #include "event.h" #include "tag.h" #include "statusbar.h" +#include "event.h" #include "layout.h" #include "layouts/tile.h" #include "layouts/floating.h" @@ -101,6 +102,8 @@ const NameFuncLink UicbList[] = { /* config.c */ {"reloadconfig", uicb_reloadconfig}, {"setstatustext", uicb_setstatustext}, + /* event.c */ + {"movemouse", uicb_movemouse}, {NULL, NULL} }; diff --git a/event.c b/event.c index 4ae0a9fb0..79e425499 100644 --- a/event.c +++ b/event.c @@ -39,14 +39,24 @@ #define CLEANMASK(mask, screen) (mask & ~(awesomeconf[screen].numlockmask | LockMask)) #define MOUSEMASK (BUTTONMASK | PointerMotionMask) -static void -movemouse(Client *c, awesome_config *awesomeconf) +void +uicb_movemouse(awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { int x1, y1, ocx, ocy, di, nx, ny; unsigned int dui; Window dummy; XEvent ev; 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); @@ -215,15 +225,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) } } else if(ev->button == Button1) - { - 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); - } + uicb_movemouse(&awesomeconf[c->screen], NULL); else if(ev->button == Button2) { if((get_current_layout(awesomeconf[c->screen].tags, diff --git a/event.h b/event.h index 8f456b6cc..264f5b236 100644 --- a/event.h +++ b/event.h @@ -41,5 +41,7 @@ void handle_event_unmapnotify(XEvent *, awesome_config *); void handle_event_shape(XEvent *, awesome_config *); void handle_event_randr_screen_change_notify(XEvent *, awesome_config *); +UICB_PROTO(uicb_movemouse); + #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99