mirror of
https://github.com/amiwm/amiwm.git
synced 2026-04-14 11:04:18 +00:00
Merge branch 'ahc_20220523_move_window_desktop'
This commit is contained in:
@@ -75,11 +75,11 @@ Currently the following are defined:
|
|||||||
rotatescreens - Move the frontmost screen to the back
|
rotatescreens - Move the frontmost screen to the back
|
||||||
raisewindow - Rotate the bottom window to the top of the screen
|
raisewindow - Rotate the bottom window to the top of the screen
|
||||||
lowerwindow - Rotate the top window to the bottom of the screen
|
lowerwindow - Rotate the top window to the bottom of the screen
|
||||||
|
rotatewindow - Move the current window to the next screen, rotate screen
|
||||||
front - Move the window in which the key is pressed to the front
|
front - Move the window in which the key is pressed to the front
|
||||||
back - Move the window in which the key is pressed to the back
|
back - Move the window in which the key is pressed to the back
|
||||||
iconify - Iconify the window in which the key is pressed
|
iconify - Iconify the window in which the key is pressed
|
||||||
|
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
Module "Keyboard" "\
|
Module "Keyboard" "\
|
||||||
|
|||||||
15
client.c
15
client.c
@@ -379,3 +379,18 @@ void flushclients()
|
|||||||
rmclient(c);
|
rmclient(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reparent the given client to the given screen.
|
||||||
|
*
|
||||||
|
* This moves the given client to the given screen.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
reparent_client(Scrn *s, Client *client)
|
||||||
|
{
|
||||||
|
client->scr = s;
|
||||||
|
if(client->parent != client->scr->root)
|
||||||
|
XReparentWindow(dpy, client->parent, s->back, client->x, client->y);
|
||||||
|
setstringprop(client->window, amiwm_screen, s->deftitle);
|
||||||
|
sendconfig(client);
|
||||||
|
}
|
||||||
|
|||||||
2
client.h
2
client.h
@@ -51,5 +51,7 @@ extern void getstate(Client *);
|
|||||||
extern void grav_map_frame_to_win(Client *, int, int, int *, int *);
|
extern void grav_map_frame_to_win(Client *, int, int, int *, int *);
|
||||||
extern void grav_map_win_to_frame(Client *, int, int, int *, int *);
|
extern void grav_map_win_to_frame(Client *, int, int, int *, int *);
|
||||||
extern void setclientstate(Client *, int);
|
extern void setclientstate(Client *, int);
|
||||||
|
extern void reparent_client(struct _Scrn *s, Client *client);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
7
icon.c
7
icon.c
@@ -156,12 +156,7 @@ void reparenticon(Icon *i, Scrn *s, int x, int y)
|
|||||||
i->next=s->icons;
|
i->next=s->icons;
|
||||||
s->icons=i;
|
s->icons=i;
|
||||||
if(i->client) {
|
if(i->client) {
|
||||||
i->client->scr=s;
|
reparent_client(s, i->client);
|
||||||
if(i->client->parent != i->client->scr->root)
|
|
||||||
XReparentWindow(dpy, i->client->parent, s->back,
|
|
||||||
i->client->x, i->client->y);
|
|
||||||
setstringprop(i->client->window, amiwm_screen, s->deftitle);
|
|
||||||
sendconfig(i->client);
|
|
||||||
}
|
}
|
||||||
if(os)
|
if(os)
|
||||||
selecticon(i);
|
selecticon(i);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ int parse_keyword(char *str, YYSTYPE *val)
|
|||||||
{ "lowerwindow", (mdfuncp)md_rotate_window_lower },
|
{ "lowerwindow", (mdfuncp)md_rotate_window_lower },
|
||||||
{ "raisewindow", (mdfuncp)md_rotate_window_raise },
|
{ "raisewindow", (mdfuncp)md_rotate_window_raise },
|
||||||
{ "rotatescreens", (mdfuncp)k_rotscreens },
|
{ "rotatescreens", (mdfuncp)k_rotscreens },
|
||||||
|
{ "rotatewindow", (mdfuncp)md_rotate_window_desktop },
|
||||||
};
|
};
|
||||||
#define N_FUNC (sizeof(functab)/sizeof(functab[0]))
|
#define N_FUNC (sizeof(functab)/sizeof(functab[0]))
|
||||||
struct { char *name; int token, num; } kwtab[] = {
|
struct { char *name; int token, num; } kwtab[] = {
|
||||||
|
|||||||
@@ -370,6 +370,7 @@ extern int md_iconify(Window);
|
|||||||
extern int md_errormsg(Window, char *);
|
extern int md_errormsg(Window, char *);
|
||||||
extern int md_rotate_window_raise(Window);
|
extern int md_rotate_window_raise(Window);
|
||||||
extern int md_rotate_window_lower(Window);
|
extern int md_rotate_window_lower(Window);
|
||||||
|
extern int md_rotate_window_desktop(Window);
|
||||||
|
|
||||||
/* eventdispatcher.c */
|
/* eventdispatcher.c */
|
||||||
extern void cx_event_broker(int, unsigned long, int (*)(XEvent*));
|
extern void cx_event_broker(int, unsigned long, int (*)(XEvent*));
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ int md_rotate_window_lower(XID id)
|
|||||||
return md_command00(id, MCMD_ROTATE_WINDOW_LOWER);
|
return md_command00(id, MCMD_ROTATE_WINDOW_LOWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int md_rotate_window_desktop(XID id)
|
||||||
|
{
|
||||||
|
return md_command00(id, MCMD_WINDOW_MOVE_NEXT_DESKTOP);
|
||||||
|
}
|
||||||
|
|
||||||
int md_errormsg(Window id, char *str)
|
int md_errormsg(Window id, char *str)
|
||||||
{
|
{
|
||||||
return md_command0(id, MCMD_ERRORMSG, str, strlen(str));
|
return md_command0(id, MCMD_ERRORMSG, str, strlen(str));
|
||||||
|
|||||||
15
module.c
15
module.c
@@ -45,6 +45,7 @@ extern void remove_fd_from_set(int);
|
|||||||
extern void screentoback();
|
extern void screentoback();
|
||||||
extern void raiselowerclient(Client *, int);
|
extern void raiselowerclient(Client *, int);
|
||||||
extern void wberror(Scrn *, char *);
|
extern void wberror(Scrn *, char *);
|
||||||
|
extern void reparent(Client *);
|
||||||
|
|
||||||
extern Icon *createappicon(struct module *, Window, char *,
|
extern Icon *createappicon(struct module *, Window, char *,
|
||||||
Pixmap, Pixmap, Pixmap, int, int);
|
Pixmap, Pixmap, Pixmap, int, int);
|
||||||
@@ -525,6 +526,20 @@ static void handle_module_cmd(struct module *m, char *data, int data_len)
|
|||||||
reply_module(m, NULL, 0);
|
reply_module(m, NULL, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MCMD_WINDOW_MOVE_NEXT_DESKTOP:
|
||||||
|
/* Move the current window, if any, to the next desktop */
|
||||||
|
c = NULL;
|
||||||
|
if(! XFindContext(dpy, id, client_context, (XPointer*)&c)) {
|
||||||
|
/* Get the current screen */
|
||||||
|
scr=getscreen(id);
|
||||||
|
/* Rotate screen, get the now front screen */
|
||||||
|
screentoback();
|
||||||
|
scr = get_front_scr();
|
||||||
|
/* Assign this client to next screen */
|
||||||
|
reparent_client(scr, c);
|
||||||
|
}
|
||||||
|
reply_module(m, NULL, 0);
|
||||||
|
break;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
reply_module(m, NULL, -1);
|
reply_module(m, NULL, -1);
|
||||||
|
|||||||
1
module.h
1
module.h
@@ -17,6 +17,7 @@
|
|||||||
#define MCMD_ROTATE_WINDOW_RAISE 19
|
#define MCMD_ROTATE_WINDOW_RAISE 19
|
||||||
#define MCMD_ROTATE_WINDOW_LOWER 20
|
#define MCMD_ROTATE_WINDOW_LOWER 20
|
||||||
#define MCMD_UPDATE_BATTERY 21
|
#define MCMD_UPDATE_BATTERY 21
|
||||||
|
#define MCMD_WINDOW_MOVE_NEXT_DESKTOP 22
|
||||||
|
|
||||||
struct mcmd_header {
|
struct mcmd_header {
|
||||||
XID id;
|
XID id;
|
||||||
|
|||||||
Reference in New Issue
Block a user