]> code.delx.au - spectrwm/blobdiff - spectrwm.c
Fix segfault when X keyboard map does not include Num_Lock.
[spectrwm] / spectrwm.c
index 0335ffa58c1c858111174caeba59da875e04f40f..00972db72d49b291ecef2ccf95372365ab8f330e 100644 (file)
@@ -6818,9 +6818,11 @@ updatenumlockmask(void)
                                    + j];
                                keycode = xcb_key_symbols_get_keycode(syms,
                                                XK_Num_Lock);
-                               if (kc == *keycode)
-                                       numlockmask = (1 << i);
-                               free(keycode);
+                               if (keycode) {
+                                       if (kc == *keycode)
+                                               numlockmask = (1 << i);
+                                       free(keycode);
+                               }
                        }
                }
                free(modmap_r);
@@ -7159,19 +7161,19 @@ setconfquirk(const char *selector, const char *value, int flags)
 void
 setup_quirks(void)
 {
-       setquirk("MPlayer",             "xv",           "",     SWM_Q_FLOAT | SWM_Q_FULLSCREEN | SWM_Q_FOCUSPREV);
-       setquirk("OpenOffice.org 3.2",  "VCLSalFrame",  "",     SWM_Q_FLOAT);
-       setquirk("Firefox-bin",         "firefox-bin",  "",     SWM_Q_TRANSSZ);
-       setquirk("Firefox",             "Dialog",       "",     SWM_Q_FLOAT);
-       setquirk("Gimp",                "gimp",         "",     SWM_Q_FLOAT | SWM_Q_ANYWHERE);
-       setquirk("XTerm",               "xterm",        "",     SWM_Q_XTERM_FONTADJ);
-       setquirk("xine",                "Xine Window",  "",     SWM_Q_FLOAT | SWM_Q_ANYWHERE);
-       setquirk("Xitk",                "Xitk Combo",   "",     SWM_Q_FLOAT | SWM_Q_ANYWHERE);
-       setquirk("xine",                "xine Panel",   "",     SWM_Q_FLOAT | SWM_Q_ANYWHERE);
-       setquirk("Xitk",                "Xine Window",  "",     SWM_Q_FLOAT | SWM_Q_ANYWHERE);
-       setquirk("xine",                "xine Video Fullscreen Window", "",     SWM_Q_FULLSCREEN | SWM_Q_FLOAT);
-       setquirk("pcb",                 "pcb",          "",     SWM_Q_FLOAT);
-       setquirk("SDL_App",             "SDL_App",      "",     SWM_Q_FLOAT | SWM_Q_FULLSCREEN);
+       setquirk("MPlayer",             "xv",           ".*",   SWM_Q_FLOAT | SWM_Q_FULLSCREEN | SWM_Q_FOCUSPREV);
+       setquirk("OpenOffice.org 3.2",  "VCLSalFrame",  ".*",   SWM_Q_FLOAT);
+       setquirk("Firefox-bin",         "firefox-bin",  ".*",   SWM_Q_TRANSSZ);
+       setquirk("Firefox",             "Dialog",       ".*",   SWM_Q_FLOAT);
+       setquirk("Gimp",                "gimp",         ".*",   SWM_Q_FLOAT | SWM_Q_ANYWHERE);
+       setquirk("XTerm",               "xterm",        ".*",   SWM_Q_XTERM_FONTADJ);
+       setquirk("xine",                "Xine Window",  ".*",   SWM_Q_FLOAT | SWM_Q_ANYWHERE);
+       setquirk("Xitk",                "Xitk Combo",   ".*",   SWM_Q_FLOAT | SWM_Q_ANYWHERE);
+       setquirk("xine",                "xine Panel",   ".*",   SWM_Q_FLOAT | SWM_Q_ANYWHERE);
+       setquirk("Xitk",                "Xine Window",  ".*",   SWM_Q_FLOAT | SWM_Q_ANYWHERE);
+       setquirk("xine",                "xine Video Fullscreen Window", ".*",   SWM_Q_FULLSCREEN | SWM_Q_FLOAT);
+       setquirk("pcb",                 "pcb",          ".*",   SWM_Q_FLOAT);
+       setquirk("SDL_App",             "SDL_App",      ".*",   SWM_Q_FLOAT | SWM_Q_FULLSCREEN);
 }
 
 /* conf file stuff */
@@ -8771,10 +8773,22 @@ mapnotify(xcb_map_notify_event_t *e)
 void
 mappingnotify(xcb_mapping_notify_event_t *e)
 {
+       struct ws_win   *w;
+       int     i, j, num_screens;
+
        xcb_refresh_keyboard_mapping(syms, e);
 
-       if (e->request == XCB_MAPPING_KEYBOARD)
+       if (e->request == XCB_MAPPING_KEYBOARD) {
                grabkeys();
+
+               /* Regrab buttons on all managed windows. */
+               num_screens = get_screen_count();
+               for (i = 0; i < num_screens; i++)
+                       for (j = 0; j < workspace_limit; j++)
+                               TAILQ_FOREACH(w, &screens[i].ws[j].winlist,
+                                   entry)
+                                       grabbuttons(w);
+       }
 }
 
 void
@@ -8960,6 +8974,10 @@ propertynotify(xcb_property_notify_event_t *e)
                                focus_flush();
                        }
                } else if (e->state == XCB_PROPERTY_DELETE) {
+                       /* Reload floating geometry in case region changed. */
+                       if (win->floating)
+                               load_float_geom(win);
+
                        /* The window is no longer iconic, restack ws. */
                        if (focus_mode != SWM_FOCUS_FOLLOW)
                                ws->focus_pending = get_focus_magic(win);