merge in Duclares stuff
authorDieter Plaetinck <dieter@plaetinck.be>
Fri, 15 May 2009 12:28:35 +0000 (14:28 +0200)
committerDieter Plaetinck <dieter@plaetinck.be>
Fri, 15 May 2009 12:28:35 +0000 (14:28 +0200)
1  2 
uzbl.c

diff --cc uzbl.c
--- 1/uzbl.c
--- 2/uzbl.c
+++ b/uzbl.c
@@@ -88,6 -87,29 +90,29 @@@ const struct 
      { NULL,                 NULL                                    }
  }, *n2v_p = var_name_to_ptr;
  
+ const struct {
+     char *key;
+     guint mask;
+ } modkeys[] = {
+     { "SHIFT",   GDK_SHIFT_MASK   }, // shift
+     { "LOCK",    GDK_LOCK_MASK    }, // capslock or shiftlock, depending on xserver's modmappings
+     { "CONTROL", GDK_CONTROL_MASK }, // control
+     { "MOD1",    GDK_MOD1_MASK    }, // 4th mod - normally alt but depends on modmappings
+     { "MOD2",    GDK_MOD2_MASK    }, // 5th mod
+     { "MOD3",    GDK_MOD3_MASK    }, // 6th mod
+     { "MOD4",    GDK_MOD4_MASK    }, // 7th mod
+     { "MOD5",    GDK_MOD5_MASK    }, // 8th mod
+     { "BUTTON1", GDK_BUTTON1_MASK }, // 1st mouse button
+     { "BUTTON2", GDK_BUTTON2_MASK }, // 2nd mouse button
+     { "BUTTON3", GDK_BUTTON3_MASK }, // 3rd mouse button
+     { "BUTTON4", GDK_BUTTON4_MASK }, // 4th mouse button
+     { "BUTTON5", GDK_BUTTON5_MASK }, // 5th mouse button
 -    { "SUPER",   GDK_SUPER_MASK   }, // super
 -    { "HYPER",   GDK_HYPER_MASK   }, // hyper
 -    { "META",    GDK_META_MASK    }, // meta
++    { "SUPER",   GDK_SUPER_MASK   }, // super (since 2.10)
++    { "HYPER",   GDK_HYPER_MASK   }, // hyper (since 2.10)
++    { "META",    GDK_META_MASK    }, // meta (since 2.10)
+     { NULL,      NULL             }
+ };
  /* construct a hash from the var_name_to_ptr array for quick access */
  static void
  make_var_to_name_hash() {
@@@ -728,61 -750,9 +753,29 @@@ set_proxy_url() 
      return;
  }
  
- static void
- set_modkey() {
-     Behaviour *b = &uzbl.behave;
-     if (!b->modkey)
-         b->modkey = "";
-     //POSSIBLE MODKEY VALUES (COMBINATIONS CAN BE USED)
-     gchar* modkeyup = g_utf8_strup (b->modkey, -1);
-     if (g_strrstr (modkeyup,"SHIFT") != NULL)    b->modmask |= GDK_SHIFT_MASK;    //the Shift key.
-     if (g_strrstr (modkeyup,"LOCK") != NULL)     b->modmask |= GDK_LOCK_MASK;     //a Lock key (depending on the modifier mapping of the X server this may either be CapsLock or ShiftLock).
-     if (g_strrstr (modkeyup,"CONTROL") != NULL)  b->modmask |= GDK_CONTROL_MASK;  //the Control key.
-     if (g_strrstr (modkeyup,"MOD1") != NULL)     b->modmask |= GDK_MOD1_MASK;     //the fourth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier, but normally it is the Alt key).
-     if (g_strrstr (modkeyup,"MOD2") != NULL)     b->modmask |= GDK_MOD2_MASK;     //the fifth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).
-     if (g_strrstr (modkeyup,"MOD3") != NULL)     b->modmask |= GDK_MOD3_MASK;     //the sixth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).
-     if (g_strrstr (modkeyup,"MOD4") != NULL)     b->modmask |= GDK_MOD4_MASK;     //the seventh modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).
-     if (g_strrstr (modkeyup,"MOD5") != NULL)     b->modmask |= GDK_MOD5_MASK;     //the eighth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).
-     if (g_strrstr (modkeyup,"BUTTON1") != NULL)  b->modmask |= GDK_BUTTON1_MASK;  //the first mouse button.
-     if (g_strrstr (modkeyup,"BUTTON2") != NULL)  b->modmask |= GDK_BUTTON2_MASK;  //the second mouse button.
-     if (g_strrstr (modkeyup,"BUTTON3") != NULL)  b->modmask |= GDK_BUTTON3_MASK;  //the third mouse button.
-     if (g_strrstr (modkeyup,"BUTTON4") != NULL)  b->modmask |= GDK_BUTTON4_MASK;  //the fourth mouse button.
-     if (g_strrstr (modkeyup,"BUTTON5") != NULL)  b->modmask |= GDK_BUTTON5_MASK;  //the fifth mouse button.
-     if (g_strrstr (modkeyup,"SUPER") != NULL)    b->modmask |= GDK_SUPER_MASK;    //the Super modifier. Since 2.10
-     if (g_strrstr (modkeyup,"HYPER") != NULL)    b->modmask |= GDK_HYPER_MASK;    //the Hyper modifier. Since 2.10
-     if (g_strrstr (modkeyup,"META") != NULL)     b->modmask |= GDK_META_MASK;     //the Meta modifier. Since 2.10  */
-     g_free (modkeyup);
- }
 +
 +static void
 +move_statusbar() {
 +    gtk_widget_ref(uzbl.gui.scrolled_win); 
 +    gtk_widget_ref(uzbl.gui.mainbar);
 +    gtk_container_remove(GTK_CONTAINER(uzbl.gui.vbox), uzbl.gui.scrolled_win);
 +    gtk_container_remove(GTK_CONTAINER(uzbl.gui.vbox), uzbl.gui.mainbar);
 +
 +    if(uzbl.behave.status_top) {
 +        gtk_box_pack_start (GTK_BOX (uzbl.gui.vbox), uzbl.gui.mainbar, FALSE, TRUE, 0);
 +        gtk_box_pack_start (GTK_BOX (uzbl.gui.vbox), uzbl.gui.scrolled_win, TRUE, TRUE, 0);
 +    }
 +    else {
 +        gtk_box_pack_start (GTK_BOX (uzbl.gui.vbox), uzbl.gui.scrolled_win, TRUE, TRUE, 0);
 +        gtk_box_pack_start (GTK_BOX (uzbl.gui.vbox), uzbl.gui.mainbar, FALSE, TRUE, 0);
 +    }
 +    gtk_widget_unref(uzbl.gui.scrolled_win);
 +    gtk_widget_unref(uzbl.gui.mainbar);
 +}
 +
  static gboolean
  var_is(const char *x, const char *y) {
-     gboolean ret = FALSE;
-     if(!strcmp(x, y))
-         ret = TRUE;
-     return ret;
+     return (strcmp(x, y) == 0 ? TRUE : FALSE );
  }
  
  static gboolean
@@@ -860,9 -829,12 +858,15 @@@ set_var_value(gchar *name, gchar *val) 
                  soup_session_add_feature(uzbl.net.soup_session,
                                           SOUP_SESSION_FEATURE(uzbl.net.soup_logger));
              }
 +            else if (var_is("status_top", name)) {
 +                move_statusbar();
 +            }
+             else if (var_is("always_insert_mode", name)) {
+                 if (*ip) {
+                     uzbl.behave.insert_mode = TRUE;
+                     update_title();
+                 }
+             }
          }
      }
      return TRUE;