Permalink
Browse files

cleaner redraw when switching modes

  • Loading branch information...
1 parent cba553e commit 0996cf6e5fdd8366a73cbebccbf339ce7ccd958c @seanpringle committed Nov 28, 2012
Showing with 8 additions and 8 deletions.
  1. +8 −8 simpleswitcher.c
View
16 simpleswitcher.c
@@ -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);

0 comments on commit 0996cf6

Please sign in to comment.