diff --git a/config.c b/config.c index 6da16eebc..99ca470a8 100644 --- a/config.c +++ b/config.c @@ -104,6 +104,7 @@ const NameFuncLink UicbList[] = { {"setstatustext", uicb_setstatustext}, /* event.c */ {"movemouse", uicb_movemouse}, + {"resizemouse", uicb_resizemouse}, {NULL, NULL} }; diff --git a/event.c b/event.c index 79e425499..dcd4a9487 100644 --- a/event.c +++ b/event.c @@ -102,11 +102,21 @@ uicb_movemouse(awesome_config *awesomeconf, const char *arg __attribute__ ((unus } } -static void -resizemouse(Client * c, awesome_config *awesomeconf) +void +uicb_resizemouse(awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { int ocx, ocy, nw, nh; XEvent ev; + 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, "DUMMY"); + else + restack(&awesomeconf[c->screen]); ocx = c->x; ocy = c->y; @@ -236,15 +246,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) uicb_zoom(&awesomeconf[c->screen], NULL); } else if(ev->button == Button3) - { - 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]); - resizemouse(c, awesomeconf); - } + uicb_resizemouse(&awesomeconf[c->screen], NULL); else if(ev->button == Button4) uicb_settrans(&awesomeconf[c->screen], "+5"); else if(ev->button == Button5) diff --git a/event.h b/event.h index 264f5b236..e91203452 100644 --- a/event.h +++ b/event.h @@ -42,6 +42,7 @@ void handle_event_shape(XEvent *, awesome_config *); void handle_event_randr_screen_change_notify(XEvent *, awesome_config *); UICB_PROTO(uicb_movemouse); +UICB_PROTO(uicb_resizemouse); #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99