1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-03 15:34:54 -05:00

cleaner redraw when switching modes

This commit is contained in:
seanpringle 2012-11-28 11:42:52 +10:00
parent cba553e2e2
commit 0996cf6e5f

View file

@ -572,25 +572,25 @@ int menu(char **lines, char **input, char *prompt, int selected, Time *time)
int x = mon.x + (mon.w - w)/2;
Window box;
XWindowAttributes attr;
// main window isn't explictly destroyed in case we switch modes. reusing it prevents flicker
if (main_window != None)
if (main_window != None && XGetWindowAttributes(display, main_window, &attr))
{
box = main_window;
XMoveResizeWindow(display, box, x, 0, w, 300);
}
else
{
box = XCreateSimpleWindow(display, root, x, 0, w, 300, 1, color_get(config_menu_bc), color_get(config_menu_bg));
XSelectInput(display, box, ExposureMask);
// make it an unmanaged window
window_set_atom_prop(box, netatoms[_NET_WM_STATE], &netatoms[_NET_WM_STATE_ABOVE], 1);
//window_set_atom_prop(box, netatoms[_NET_WM_WINDOW_TYPE], &netatoms[_NET_WM_WINDOW_TYPE_DOCK], 1);
XSetWindowAttributes sattr; sattr.override_redirect = True;
XChangeWindowAttributes(display, box, CWOverrideRedirect, &sattr);
main_window = box;
}
// make it an unmanaged window
window_set_atom_prop(box, netatoms[_NET_WM_STATE], &netatoms[_NET_WM_STATE_ABOVE], 1);
//window_set_atom_prop(box, netatoms[_NET_WM_WINDOW_TYPE], &netatoms[_NET_WM_WINDOW_TYPE_DOCK], 1);
XSetWindowAttributes attr; attr.override_redirect = True;
XChangeWindowAttributes(display, box, CWOverrideRedirect, &attr);
// search text input
textbox *text = textbox_create(box, TB_AUTOHEIGHT|TB_EDITABLE, 5, 5, w-10, 1,
config_menu_font, config_menu_fg, config_menu_bg, "", prompt);