55c55 < void generate_animation_positions(struct tilda_window_ *tw) --- > void generate_animation_positions (struct tilda_window_ *tw) 58,62d57 < < #if DEBUG < printf("generate_animation_positions(): %d\n",cfg_getint (tw->tc, "animation_orientation")); < #endif < 91c86 < posIV[1][i] = (gint)(posCFV[i]*last_height); --- > posIV[1][i] = (gint)(posCFV[i]*last_height); 98c93 < posIV[1][i] = (gint)(posCFV[i]*last_height); --- > posIV[1][i] = (gint)(posCFV[i]*last_height); 106,109d100 < #ifdef DEBUG < puts("pull"); < #endif < 113c104 < --- > 148,149c139,140 < gtk_window_move ((GtkWindow *) tw->window, cfg_getint (tw->tc, "x_pos"), cfg_getint (tw->tc, "y_pos")); < gtk_window_resize ((GtkWindow *) tw->window, cfg_getint (tw->tc, "max_width"), cfg_getint (tw->tc, "max_height")); --- > //gtk_window_move ((GtkWindow *) tw->window, cfg_getint (tw->tc, "x_pos"), cfg_getint (tw->tc, "y_pos")); > //gtk_window_resize ((GtkWindow *) tw->window, cfg_getint (tw->tc, "max_width"), cfg_getint (tw->tc, "max_height")); 183c174 < gtk_window_resize ((GtkWindow *) tw->window, cfg_getint (tw->tc, "min_width"), cfg_getint (tw->tc, "min_height")); --- > //gtk_window_resize ((GtkWindow *) tw->window, cfg_getint (tw->tc, "min_width"), cfg_getint (tw->tc, "min_height")); 203c194 < static void key_grab (tilda_window *tw) --- > static int parse_key (tilda_window *tw, gchar *key_str, KeySym *key_ret) 205,209d195 < #ifdef DEBUG < puts("key_grab"); < #endif < < XModifierKeymap *modmap; 211,213c197,198 < unsigned int numlockmask = 0; < unsigned int modmask = 0; < gint i, j; --- > KeySym key = NoSymbol; > gchar *key_ptr = key_str; 215c200,201 < g_strlcpy (tmp_key, cfg_getstr (tw->tc, "key"), sizeof (tmp_key)); --- > /* Exceptions to "normal" keys go here, such as the "grave" key */ > if (g_strrstr (key_str, "`")) { key_ptr = "grave"; } 217,219c203,207 < /* Key grabbing stuff taken from yeahconsole who took it from evilwm */ < modmap = XGetModifierMapping(dpy); < for (i = 0; i < 8; i++) --- > /* Now, try to have XStringToKeysym() parse it */ > key = XStringToKeysym (key_ptr); > > /* Check for failure */ > if (key == NoSymbol) 221c209,217 < for (j = 0; j < modmap->max_keypermod; j++) --- > /* Use default */ > fprintf (stderr, "Bad key: \"%s\" not recognized. Using default of F%d " > " (leaving your modifiers as-is).\n", key_ptr, tw->instance+1); > g_snprintf (tmp_key, sizeof(tmp_key), "F%d", tw->instance+1); > > /* Re-parse the default key */ > key = XStringToKeysym (tmp_key); > > if (key == NoSymbol) 223,226c219,220 < if (modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock)) < { < numlockmask = (1 << i); < } --- > fprintf (stderr, "Using the default failed, bailing out...\n"); > exit (EXIT_FAILURE); 230c224 < XFreeModifiermap(modmap); --- > *key_ret = key; 232,233c226,243 < if (strstr(tmp_key, "Control")) < modmask = modmask | ControlMask; --- > return 0; > } > > static int parse_keybinding (tilda_window *tw, guint *modmask_ret, KeySym *key_ret) > { > guint modmask = 0; > KeySym key = NoSymbol; > gchar *key_str; > gchar **key_split; > gint i; > > key_str = g_strdup (cfg_getstr (tw->tc, "key")); > key_str = g_strstrip (key_str); > key_split = g_strsplit (key_str, "+", 3); > > for (i=0; i { > g_strstrip (key_split[i]); 235,236c245,263 < if (strstr(tmp_key, "Alt")) < modmask = modmask | Mod1Mask; --- > /* Now each key_split[i] can be either a mask or a key */ > if (g_strrstr (key_split[i], "None")) { modmask = 0; } > else if (g_strrstr (key_split[i], "Control")) { modmask |= ControlMask; } > else if (g_strrstr (key_split[i], "Alt")) { modmask |= Mod1Mask; } > else if (g_strrstr (key_split[i], "Win")) { modmask |= Mod4Mask; } > else /* Must be a key */ > { > parse_key (tw, key_split[i], &key); > } > } > > g_free (key_str); > g_strfreev (key_split); > > *key_ret = key; > *modmask_ret = modmask; > > return 0; > } 238,239c265,274 < if (strstr(tmp_key, "Win")) < modmask = modmask | Mod4Mask; --- > /* > * This will grab the key from the X server for exclusive use by > * our application. > */ > void key_grab (tilda_window *tw) > { > XModifierKeymap *modmap; > guint numlockmask = 0; > guint modmask = 0; > gint i, j; 241,242c276,277 < if (strstr(tmp_key, "None")) < modmask = 0; --- > /* Key grabbing stuff taken from yeahconsole who took it from evilwm */ > modmap = XGetModifierMapping(dpy); 244,245c279,282 < if (!strstr(tmp_key, "+")) < perror ("Key Incorrect -- Read the README or tilda.sf.net for info, rerun as 'tilda -C' to set keybinding\n"); --- > for (i = 0; i < 8; i++) > for (j = 0; j < modmap->max_keypermod; j++) > if (modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock)) > numlockmask = (1 << i); 247,248c284 < if (strtok(tmp_key, "+")) < key = XStringToKeysym(strtok(NULL, "+")); --- > XFreeModifiermap(modmap); 249a286,301 > /* Parse the keybinding from the config file. > * > * NOTE: the variable "key" is global, so it can be used here and > * in the wait_for_signal() function below. > */ > parse_keybinding (tw, &modmask, &key); > > /* Bind the key(s) appropriately. > * > * NOTE: If you're getting BadAccess errors from here in the code, then > * something in your environment has already bound this key! Use a different > * keybinding. > * > * Unfortunately, we can't report this to the user, since X kills the program > * automatically when it recieves a BadAccess error. :( > */ 257a310,357 > > /* Make absolutely sure that these are grabbed at this point. */ > XFlush (dpy); > } > > /* > * This will "ungrab" the key that is currently being used by the application > * to toggle the window state. > * > * This should be used in the wizard just before the key grabber button is > * pressed, so that the user can press the same key that they are using. > */ > void key_ungrab (tilda_window *tw) > { > XModifierKeymap *modmap; > guint numlockmask = 0; > guint modmask = 0; > gint i, j; > > /* Key grabbing stuff taken from yeahconsole who took it from evilwm */ > modmap = XGetModifierMapping(dpy); > > for (i = 0; i < 8; i++) > for (j = 0; j < modmap->max_keypermod; j++) > if (modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock)) > numlockmask = (1 << i); > > XFreeModifiermap(modmap); > > /* Parse the keybinding from the config file. > * > * NOTE: the variable "key" is global, so it can be used here and > * in the wait_for_signal() function below. > */ > parse_keybinding (tw, &modmask, &key); > > /* Unbind the key(s) appropriately. */ > XUngrabKey(dpy, XKeysymToKeycode(dpy, key), modmask, root); > XUngrabKey(dpy, XKeysymToKeycode(dpy, key), LockMask | modmask, root); > > if (numlockmask) > { > XUngrabKey(dpy, XKeysymToKeycode(dpy, key), numlockmask | modmask, root); > XUngrabKey(dpy, XKeysymToKeycode(dpy, key), numlockmask | LockMask | modmask, root); > } > > /* Make absolutely sure that the keys are unbound by now */ > XFlush (dpy); 266c366,369 < fprintf (stderr, "Shit -- can't open Display %s", XDisplayName(NULL)); --- > { > fprintf (stderr, "Cannot open Display %s", XDisplayName(NULL)); > exit (EXIT_FAILURE); > } 271c374 < display_width = DisplayWidth(dpy, screen); --- > display_width = DisplayWidth(dpy, screen); 273c376 < --- > 279c382 < * Fixes bug that causes Tilda to eat up 100% of CPU --- > * Fixes bug that causes Tilda to eat up 100% of CPU 281c384 < */ --- > */