Skip to content

Commit

Permalink
rename zwm_client_warp to ..mouse_warp
Browse files Browse the repository at this point in the history
  • Loading branch information
damaru committed Apr 1, 2016
1 parent dbd9370 commit 9a6d0fe
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 28 deletions.
24 changes: 8 additions & 16 deletions actions.h
Expand Up @@ -204,24 +204,10 @@ static void run_once(const char *arg){
char data[1024];
char *cmd;
char *cls;
//Client *c = NULL;
strcpy(data,arg);
cls = strtok(data, ";");
cmd = cls + strlen(cls) + 1;
#if 0
zwm_client_foreach(c) {
if(strcasecmp(c->cname, cls) == 0) {
zwm_client_zoom(c);
return;
}
}
zwm_client_foreach(c) {
if(strcasestr(c->name, cls)) {
zwm_client_zoom(c);
return;
}
}
#endif

if (!pull(arg))
zwm_util_spawn(cmd);
}
Expand Down Expand Up @@ -293,6 +279,12 @@ static void close_window(const char *arg) {
}
}

static void duplicate_window(const char *arg) {
if (sel && sel->cmd[0]) {
zwm_util_spawn(sel->cmd);
}
}

static void toggle_floating(const char *arg) {
if (sel) {
zwm_client_toggle_floating(sel);
Expand All @@ -307,7 +299,7 @@ static void do_focus(Client *c)
{
if (c) {
zwm_client_raise(c, False);
zwm_client_warp(c);
zwm_mouse_warp(c);
}
}

Expand Down
12 changes: 1 addition & 11 deletions client.c
Expand Up @@ -317,16 +317,6 @@ Bool zwm_client_visible(Client *c, int view)
(c->type == ZwmNormalWindow || c->type == ZwmDialogWindow) ;
}

void zwm_client_warp(Client *c)
{
if(c) {
XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask );
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
zwm_x11_flush_events(EnterWindowMask);
XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
}
}

void zwm_client_refocus(void)
{
Client *c = head;
Expand Down Expand Up @@ -372,7 +362,7 @@ void zwm_client_raise(Client *c, Bool warp)
zwm_client_setstate(c, NormalState);
if (warp) {
zwm_layout_rearrange(True);
zwm_client_warp(c);
zwm_mouse_warp(c);
}
zwm_client_configure_window(c);
}
Expand Down
1 change: 1 addition & 0 deletions config.h
Expand Up @@ -97,6 +97,7 @@ ZwmConfig config =
{"Alt-b", banish_all, NULL},
{"Alt-Shift-b", banish_non_class, NULL},
{"Alt-c", banish_class, NULL},
{"Alt-d", duplicate_window, NULL},
{"Alt-Shift-1", set_view, "0"},
{"Alt-Shift-2", set_view, "1"},
{"Alt-Shift-3", set_view, "2"},
Expand Down
13 changes: 13 additions & 0 deletions mouse.c
Expand Up @@ -43,6 +43,19 @@ zwm_mouse_grab(Client *c, Bool focused)
}
}

static int warp = 1;

void zwm_mouse_warp(Client *c)
{
if(c && warp) {
XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask );
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
zwm_x11_flush_events(EnterWindowMask);
XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
}
}


static void
grab(Window win, unsigned int button)
{
Expand Down
2 changes: 1 addition & 1 deletion zwm.h
Expand Up @@ -276,7 +276,6 @@ void zwm_client_unfullscreen(Client* c);
void zwm_client_unmanage(Client* );
void zwm_client_update_hints(Client *c);
void zwm_client_update_name(Client* );
void zwm_client_warp(Client* c);
void zwm_client_zoom(Client* );

int zwm_current_screen();
Expand Down Expand Up @@ -310,6 +309,7 @@ void zwm_layout_pop(void);
void zwm_mouse_init(Display *dpy);
void zwm_mouse_cleanup(Display *dpy);
void zwm_mouse_grab(Client *c, Bool focused);
void zwm_mouse_warp(Client* c);

void zwm_panel_hide();
void zwm_panel_init(void);
Expand Down

0 comments on commit 9a6d0fe

Please sign in to comment.