diff --git a/constants.h b/constants.h index cfe8add..074a378 100644 --- a/constants.h +++ b/constants.h @@ -425,6 +425,7 @@ enum RDP_INPUT_DEVICE #define SEAMLESSRDP_POSITION_TIMER 200000 #define SEAMLESSRDP_CREATE_MODAL 0x0001 +#define SEAMLESSRDP_CREATE_TOPMOST 0x0002 #define SEAMLESSRDP_HELLO_RECONNECT 0x0001 #define SEAMLESSRDP_HELLO_HIDDEN 0x0002 diff --git a/ewmhints.c b/ewmhints.c index 15254d3..f2280ce 100644 --- a/ewmhints.c +++ b/ewmhints.c @@ -36,7 +36,7 @@ extern Display *g_display; static Atom g_net_wm_state_maximized_vert_atom, g_net_wm_state_maximized_horz_atom, g_net_wm_state_hidden_atom, g_net_wm_name_atom, g_utf8_string_atom, g_net_wm_state_skip_taskbar_atom, g_net_wm_state_skip_pager_atom, - g_net_wm_state_modal_atom, g_net_wm_icon_atom; + g_net_wm_state_modal_atom, g_net_wm_icon_atom, g_net_wm_state_above_atom; Atom g_net_wm_state_atom, g_net_wm_desktop_atom; @@ -186,6 +186,7 @@ ewmh_init() XInternAtom(g_display, "_NET_WM_STATE_SKIP_TASKBAR", False); g_net_wm_state_skip_pager_atom = XInternAtom(g_display, "_NET_WM_STATE_SKIP_PAGER", False); g_net_wm_state_modal_atom = XInternAtom(g_display, "_NET_WM_STATE_MODAL", False); + g_net_wm_state_above_atom = XInternAtom(g_display, "_NET_WM_STATE_ABOVE", False); g_net_wm_state_atom = XInternAtom(g_display, "_NET_WM_STATE", False); g_net_wm_desktop_atom = XInternAtom(g_display, "_NET_WM_DESKTOP", False); g_net_wm_name_atom = XInternAtom(g_display, "_NET_WM_NAME", False); @@ -533,6 +534,14 @@ ewmh_del_icon(Window wnd, int width, int height) XFree(cur_set); } +int +ewmh_set_window_above(Window wnd) +{ + if (ewmh_modify_state(wnd, 1, g_net_wm_state_above_atom, 0) < 0) + return -1; + return 0; +} + #endif /* MAKE_PROTO */ diff --git a/xproto.h b/xproto.h index 15be664..69bea4d 100644 --- a/xproto.h +++ b/xproto.h @@ -11,3 +11,4 @@ int ewmh_set_window_popup(Window wnd); int ewmh_set_window_modal(Window wnd); void ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data); void ewmh_del_icon(Window wnd, int width, int height); +int ewmh_set_window_above(Window wnd); diff --git a/xwin.c b/xwin.c index af42097..b5d54fe 100644 --- a/xwin.c +++ b/xwin.c @@ -3452,6 +3452,12 @@ ui_seamless_create_window(unsigned long id, unsigned long group, unsigned long p ewmh_set_window_modal(wnd); } + if (flags & SEAMLESSRDP_CREATE_TOPMOST) + { + /* Make window always-on-top */ + ewmh_set_window_above(wnd); + } + /* FIXME: Support for Input Context:s */ get_input_mask(&input_mask); @@ -3706,6 +3712,12 @@ ui_seamless_restack_window(unsigned long id, unsigned long behind, unsigned long } sw_restack_window(sw, behind); + + if (flags & SEAMLESSRDP_CREATE_TOPMOST) + { + /* Make window always-on-top */ + ewmh_set_window_above(sw->wnd); + } }