]> hydra-www.ietfng.org Git - gtetrinet/commitdiff
hide the cursor while playing
authorDaniel Carbonell Fraj <bocata@src.gnome.org>
Mon, 2 Jun 2003 16:05:46 +0000 (16:05 +0000)
committerDaniel Carbonell Fraj <bocata@src.gnome.org>
Mon, 2 Jun 2003 16:05:46 +0000 (16:05 +0000)
ChangeLog
src/dialogs.c
src/fields.c
src/tetrinet.c

index e75d45ae1adda30621d6ef0b6d0fa4a5cd601c3f..debd54255d0cc1d616cbc5e803e5eab2e18bf67f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2003-06-02  Dani Carbonell  <bocata@panete.net>
+
+       * src/fields.c (fields_page_new): create here the cursors that
+       will be used later to hide/restore the main cursor.
+       (fields_expose_event, fields_nextpiece_expose) 
+       (fields_specials_expose): hide the cursor if the user is in a
+       game, show it otherwise.
+
+       * src/dialogs.c (connectingdialog_new): set a parent for this
+       window, set it modal, and don't show it in the windows list.
+       
+
 2003-05-28  Danilo Ĺ egan  <dsegan@gmx.net>
 
        * configure.in: Added "sr" and "sr@Latn" to ALL_LINGUAS.
index 0fead7d9e7c70828f2e77f348b9356963960e61a..1805d7b5a457fb42ad38246b4916490721edd9d3 100644 (file)
@@ -43,7 +43,7 @@ extern GtkWidget *app;
 /*****************************************************/
 /* connecting dialog - a dialog with a cancel button */
 /*****************************************************/
-static GtkWidget *connectingdialog = 0;
+static GtkWidget *connectingdialog = 0, *connectdialog;
 static GtkWidget *progressbar;
 static gint timeouttag = 0;
 
@@ -83,10 +83,11 @@ void connectingdialog_new (void)
       return;
     }
     connectingdialog = gtk_dialog_new_with_buttons (_("Connect to server"),
-                                                    NULL,
-                                                    0,
+                                                    GTK_WINDOW (connectdialog),
+                                                    GTK_DIALOG_MODAL,
                                                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                                     NULL);
+    gtk_window_set_skip_taskbar_hint (GTK_WINDOW (connectingdialog), TRUE);
     progressbar = gtk_progress_bar_new ();
     gtk_widget_show (progressbar);
     gtk_box_pack_start (GTK_BOX (GTK_DIALOG(connectingdialog)->vbox),
@@ -158,6 +159,7 @@ void teamdialog_new (void)
                                                GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE,
                                                GTK_STOCK_OK, GTK_RESPONSE_OK,
                                                NULL);
+    gtk_window_set_skip_taskbar_hint (GTK_WINDOW (team_dialog), TRUE);
     gtk_dialog_set_default_response (GTK_DIALOG (team_dialog), GTK_RESPONSE_OK);    
     gtk_window_set_position (GTK_WINDOW (team_dialog), GTK_WIN_POS_MOUSE);
     gtk_window_set_resizable (GTK_WINDOW (team_dialog), FALSE);
@@ -187,7 +189,7 @@ void teamdialog_new (void)
 /**********************/
 static int connecting;
 static GtkWidget *serveraddressentry, *nicknameentry, *teamnameentry, *spectatorcheck, *passwordentry;
-static GtkWidget *connectdialog, *passwordlabel, *teamnamelabel;
+static GtkWidget *passwordlabel, *teamnamelabel;
 static GtkWidget *originalradio, *tetrifastradio;
 static GSList *gametypegroup;
 static int oldgamemode;
@@ -260,7 +262,8 @@ void connectdialog_button (GtkDialog *dialog, gint button)
         gconf_client_set_string (gconf_client, "/apps/gtetrinet/player/server", server1, NULL);
         gconf_client_set_string (gconf_client, "/apps/gtetrinet/player/nickname", nick, NULL);
         gconf_client_set_string (gconf_client, "/apps/gtetrinet/player/team",
-                                 gtk_entry_get_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(teamnameentry)))), NULL);
+                                 gtk_entry_get_text (GTK_ENTRY(gnome_entry_gtk_entry(GNOME_ENTRY(teamnameentry)))),
+                                 NULL);
         g_free (team_utf8);
         g_free (nick);
         break;
index 62b9852de719ed4fafa8dc9c17b98e4a5e228060..a34be6b27f0fab7bd8359bb405b683c737d1e1a0 100644 (file)
@@ -44,8 +44,8 @@ static GtkWidget *fieldwidgets[6], *nextpiecewidget, *fieldlabels[6][6],
 static GtkWidget *fields_page_contents (void);
 
 static gint fields_expose_event (GtkWidget *widget, GdkEventExpose *event, int field);
-static gint fields_nextpiece_expose (void);
-static gint fields_specials_expose (void);
+static gint fields_nextpiece_expose (GtkWidget *widget);
+static gint fields_specials_expose (GtkWidget *widget);
 
 static void fields_refreshfield (int field);
 static void fields_drawblock (int field, int x, int y, char block);
@@ -54,9 +54,24 @@ static void gmsginput_activate (void);
 
 static GdkPixmap *blockpix;
 
+static GdkColor black = {0, 0, 0, 0};
+static GdkBitmap *bitmap;
+static GdkCursor *invisible_cursor, *arrow_cursor;
+
 static FIELD displayfields[6]; /* what is actually displayed */
 static TETRISBLOCK displayblock;
 
+/*
+  GdkColor black = {0,0,0};
+  GdkBitmap *bitmap;
+  GdkCursor *invisible_cursor, *current_cursor;
+  
+  bitmap = gdk_bitmap_create_from_data (widget->window, "\0", 1, 1);
+  invisible_cursor = gdk_cursor_new_from_pixmap (bitmap, bitmap, &black, &black, 0, 0);
+
+  gdk_window_set_cursor (window, cursor);
+*/
+
 void fields_init (void)
 {
     GtkWidget *mb;
@@ -70,7 +85,7 @@ void fields_init (void)
                                      GTK_MESSAGE_ERROR,
                                      GTK_BUTTONS_OK,
                                      _("Error loading theme: cannot load graphics file\n"
-                                      "Falling back to default"));
+                                       "Falling back to default"));
         gtk_dialog_run (GTK_DIALOG (mb));
         gtk_widget_destroy (mb);
        g_string_assign(currenttheme, DEFAULTTHEME);
@@ -105,6 +120,11 @@ GtkWidget *fields_page_new (void)
     }
     gtk_container_add (GTK_CONTAINER(fieldspage), pagecontents);
 
+    /* create the cursors */
+    bitmap = gdk_bitmap_create_from_data (GTK_WIDGET (fieldspage)->window, "\0", 1, 1);
+    invisible_cursor = gdk_cursor_new_from_pixmap (bitmap, bitmap, &black, &black, 0, 0);
+    arrow_cursor = gdk_cursor_new (GDK_ARROW);
+
     return fieldspage;
 }
 
@@ -169,6 +189,7 @@ GtkWidget *fields_page_contents (void)
             gtk_box_pack_start (GTK_BOX(box), widget, TRUE, TRUE, 0);
             /* the field */
             fieldwidgets[i] = gtk_drawing_area_new ();
+            
             /* attach the signals */
             g_signal_connect (G_OBJECT(fieldwidgets[i]), "expose_event",
                                 GTK_SIGNAL_FUNC(fields_expose_event), (gpointer)i);
@@ -329,6 +350,11 @@ gint fields_expose_event (GtkWidget *widget, GdkEventExpose *event, int field)
     widget = widget;
     event = event;
     fields_refreshfield (field);
+    /* hide the cursor */
+    if (ingame)
+      gdk_window_set_cursor (widget->window, invisible_cursor);
+    else
+      gdk_window_set_cursor (widget->window, arrow_cursor);
 
     return FALSE;
 }
@@ -441,15 +467,23 @@ void fields_setspeciallabel (char *label)
     }
 }
 
-gint fields_nextpiece_expose (void)
+gint fields_nextpiece_expose (GtkWidget *widget)
 {
     fields_drawnextblock (NULL);
+    if (ingame)
+      gdk_window_set_cursor (widget->window, invisible_cursor);
+    else
+      gdk_window_set_cursor (widget->window, arrow_cursor);
     return FALSE;
 }
 
-gint fields_specials_expose (void)
+gint fields_specials_expose (GtkWidget *widget)
 {
     fields_drawspecials ();
+    if (ingame)
+      gdk_window_set_cursor (widget->window, invisible_cursor);
+    else
+      gdk_window_set_cursor (widget->window, arrow_cursor);
     return FALSE;
 }
 
index 53feb936e2857409bbff79d2f4f3a4427e7a712e..877fed87361ef55ec291d9b67359d4ce6cc155dc 100644 (file)
@@ -412,7 +412,7 @@ void tetrinet_inmessage (enum inmsg_type msgtype, char *data)
                   gchar *line = nocolor (token);
                   gchar *aux;
                       
-                  if (list_issued > 0)
+                  if (list_enabled && (list_issued > 0))
                   {
                     if (*line == '(')
                     {