]> hydra-www.ietfng.org Git - gtetrinet/commitdiff
Steve Kemp's special-to-self patch main
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Fri, 29 Jan 2016 06:55:02 +0000 (01:55 -0500)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Fri, 29 Jan 2016 06:56:45 +0000 (01:56 -0500)
Originally from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291844

src/config.c
src/dialogs.c
src/gtet_config.h
src/gtetrinet.c
src/tetrinet.c

index e36b17221e56ba00fc84be784f64a4b1941511bc..cb80e7cce4c57d5c8f5c684b8f49304802b6b405 100644 (file)
@@ -72,7 +72,8 @@ guint defaultkeys[K_NUM] = {
     GDK_3,
     GDK_4,
     GDK_5,
-    GDK_6
+    GDK_6,
+    GDK_s
 };
 
 guint keys[K_NUM];
@@ -367,6 +368,14 @@ void config_loadconfig (void)
     else
       keys[K_SPECIAL6] = defaultkeys[K_SPECIAL6];
 
+    p = gconf_client_get_string (gconf_client, "/apps/gtetrinet/keys/special_self", NULL);
+    if (p)
+    {
+      keys[K_SPECIAL_SELF] = gdk_keyval_to_lower (gdk_keyval_from_name (p));
+      g_free (p);
+    }
+    else
+      keys[K_SPECIAL_SELF] = defaultkeys[K_SPECIAL_SELF];
 
     /* Get the timestamp option. */
     timestampsenable = gconf_client_get_bool (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps", NULL);
@@ -624,6 +633,18 @@ keys_special6_changed (GConfClient *client,
   keys[K_SPECIAL6] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
 }
 
+void
+keys_special_self_changed (GConfClient *client,
+                       guint cnxn_id,
+                       GConfEntry *entry)
+{
+
+  client = client;
+  cnxn_id = cnxn_id;
+
+  keys[K_SPECIAL_SELF] = gdk_keyval_to_lower (gdk_keyval_from_name (gconf_value_get_string (gconf_entry_get_value (entry))));
+}
+
 void
 partyline_enable_timestamps_changed (GConfClient *client,
                                      guint cnxn_id,
index 0d6330502146c07531efb8a6e7d95838e6b60eea..a2984fa33e3ef56dc938f9bcf81c2e8569f3fc72 100644 (file)
@@ -548,6 +548,7 @@ void prefdialog_drawkeys (void)
     actions[K_SPECIAL4] = _("Special to field 4");
     actions[K_SPECIAL5] = _("Special to field 5");
     actions[K_SPECIAL6] = _("Special to field 6");
+    actions[K_SPECIAL_SELF] = _("Special to self");
   
     gconf_keys[K_RIGHT]    = g_strdup ("/apps/gtetrinet/keys/right");
     gconf_keys[K_LEFT]     = g_strdup ("/apps/gtetrinet/keys/left");
@@ -563,6 +564,7 @@ void prefdialog_drawkeys (void)
     gconf_keys[K_SPECIAL4] = g_strdup ("/apps/gtetrinet/keys/special4");
     gconf_keys[K_SPECIAL5] = g_strdup ("/apps/gtetrinet/keys/special5");
     gconf_keys[K_SPECIAL6] = g_strdup ("/apps/gtetrinet/keys/special6");
+    gconf_keys[K_SPECIAL_SELF] = g_strdup ("/apps/gtetrinet/keys/special_self");
 
     for (i = 0; i < K_NUM; i ++) {
         gtk_list_store_append (keys_store, &iter);
index 37ea82557d9e1f57a72be42e3e97d5e023ab10e2..f388856805012d01daad698cd9f642fd861e8751 100644 (file)
@@ -101,6 +101,11 @@ keys_special6_changed (GConfClient *client,
                    guint cnxn_id,
                    GConfEntry *entry);
 
+void
+keys_special_self_changed (GConfClient *client,
+                   guint cnxn_id,
+                   GConfEntry *entry);
+
 void
 partyline_enable_timestamps_changed (GConfClient *client,
                                      guint cnxn_id,
@@ -131,6 +136,7 @@ typedef enum
   K_SPECIAL4,
   K_SPECIAL5,
   K_SPECIAL6,
+  K_SPECIAL_SELF,
 /* not a key but the number of configurable keys */
   K_NUM
 } GTetrinetKeys;
index 4450dd51c4ad3d62cbcb62ea5d62de731f8693cc..cf03084ff74239fbaec35be2816d43ded7caf992 100644 (file)
@@ -210,6 +210,10 @@ int main (int argc, char *argv[])
                              (GConfClientNotifyFunc) keys_special6_changed,
                             NULL, NULL, NULL);
 
+    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special_self",
+                             (GConfClientNotifyFunc) keys_special_self_changed,
+                            NULL, NULL, NULL);
+
     gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps",
                              (GConfClientNotifyFunc) partyline_enable_timestamps_changed,
                             NULL, NULL, NULL);
index ca5c5cf1c8ea73b07531822b4cf8f5551d419b91..7f970935fd41af82850a09f696ad62000998b335 100644 (file)
@@ -1811,6 +1811,16 @@ notfieldkey:
         tetris_drawcurrentblock ();
         return TRUE;
     }
+    else if (gdk_keyval_to_lower (keyval) == keys[K_SPECIAL_SELF]) {
+       tetrinet_specialkey(playernum);
+        tetris_drawcurrentblock ();
+        return TRUE;
+    }
+    else if (gdk_keyval_to_lower (keyval) == keys[K_SPECIAL_SELF]) {
+       tetrinet_specialkey(playernum);
+        tetris_drawcurrentblock ();
+        return TRUE;
+    }
     tetris_drawcurrentblock ();
     return FALSE;
 }