Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2006:
[Freeciv-Dev] (PR#15111) ggz_remove_input function
Home

[Freeciv-Dev] (PR#15111) ggz_remove_input function

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#15111) ggz_remove_input function
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 8 Jan 2006 20:10:12 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15111 >

This patch adds a remove_ggz_input function corresponding to 
add_ggz_input (or to remove_net_input).  It's called on disconnection 
when in GGZ mode to stop monitoring the GGZ socket.

-jason

Index: client/gui-gtk-2.0/gui_main.c
===================================================================
--- client/gui-gtk-2.0/gui_main.c       (revision 11429)
+++ client/gui-gtk-2.0/gui_main.c       (working copy)
@@ -194,7 +194,7 @@
 
 static enum Display_color_type display_color_type;  /* practically unused */
 static gint timer_id;                               /*       ditto        */
-static guint input_id;
+static guint input_id, ggz_input_id;
 
 
 static gboolean show_info_button_release(GtkWidget *w, GdkEventButton *ev, 
gpointer data);
@@ -1699,10 +1699,19 @@
 **************************************************************************/
 void add_ggz_input(int sock)
 {
-  (void) gtk_input_add_full(sock, GDK_INPUT_READ, get_ggz_input,
-                           NULL, NULL, NULL);
+  ggz_input_id = gtk_input_add_full(sock, GDK_INPUT_READ, get_ggz_input,
+                                   NULL, NULL, NULL);
 }
 
+/**************************************************************************
+  Called on disconnection to remove monitoring on the GGZ socket.  Only
+  call this if we're actually in GGZ mode.
+**************************************************************************/
+void remove_ggz_input(void)
+{
+  gtk_input_remove(ggz_input_id);
+}
+
 /****************************************************************
   This is the response callback for the dialog with the message:
   Are you sure you want to quit?
Index: client/gui-xaw/gui_main.c
===================================================================
--- client/gui-xaw/gui_main.c   (revision 11429)
+++ client/gui-xaw/gui_main.c   (working copy)
@@ -818,6 +818,23 @@
 }
 
 /**************************************************************************
+  Called to monitor a GGZ socket.
+**************************************************************************/
+void add_ggz_input(int sock)
+{
+  /* PORTME */
+}
+
+/**************************************************************************
+  Called on disconnection to remove monitoring on the GGZ socket.  Only
+  call this if we're actually in GGZ mode.
+**************************************************************************/
+void remove_ggz_input(void)
+{
+  /* PORTME */
+}
+
+/**************************************************************************
 ...
 **************************************************************************/
 void end_turn_callback(Widget w, XtPointer client_data, XtPointer call_data)
Index: client/include/gui_main_g.h
===================================================================
--- client/include/gui_main_g.h (revision 11429)
+++ client/include/gui_main_g.h (working copy)
@@ -28,6 +28,7 @@
 void add_net_input(int);
 void remove_net_input(void);
 void add_ggz_input(int socket);
+void remove_ggz_input(void);
 
 void set_unit_icon(int idx, struct unit *punit);
 void set_unit_icons_more_arrow(bool onoff);
Index: client/gui-win32/gui_main.c
===================================================================
--- client/gui-win32/gui_main.c (revision 11429)
+++ client/gui-win32/gui_main.c (working copy)
@@ -858,8 +858,25 @@
 }
 
 /**************************************************************************
+  Called to monitor a GGZ socket.
+**************************************************************************/
+void add_ggz_input(int sock)
+{
+  /* PORTME */
+}
 
+/**************************************************************************
+  Called on disconnection to remove monitoring on the GGZ socket.  Only
+  call this if we're actually in GGZ mode.
 **************************************************************************/
+void remove_ggz_input(void)
+{
+  /* PORTME */
+}
+
+/**************************************************************************
+
+**************************************************************************/
 void
 set_unit_icon(int idx, struct unit *punit)
 {
Index: client/gui-sdl/gui_main.c
===================================================================
--- client/gui-sdl/gui_main.c   (revision 11429)
+++ client/gui-sdl/gui_main.c   (working copy)
@@ -1039,6 +1039,23 @@
   SDL_SetCursor(pStd_Cursor);
 }
 
+/**************************************************************************
+  Called to monitor a GGZ socket.
+**************************************************************************/
+void add_ggz_input(int sock)
+{
+  /* PORTME */
+}
+
+/**************************************************************************
+  Called on disconnection to remove monitoring on the GGZ socket.  Only
+  call this if we're actually in GGZ mode.
+**************************************************************************/
+void remove_ggz_input(void)
+{
+  /* PORTME */
+}
+
 /****************************************************************************
   Enqueue a callback to be called during an idle moment.  The 'callback'
   function should be called sometimes soon, and passed the 'data' pointer
Index: client/gui-ftwl/gui_main.c
===================================================================
--- client/gui-ftwl/gui_main.c  (revision 11429)
+++ client/gui-ftwl/gui_main.c  (working copy)
@@ -282,6 +282,23 @@
 }
 
 /**************************************************************************
+  Called to monitor a GGZ socket.
+**************************************************************************/
+void add_ggz_input(int sock)
+{
+  /* PORTME */
+}
+
+/**************************************************************************
+  Called on disconnection to remove monitoring on the GGZ socket.  Only
+  call this if we're actually in GGZ mode.
+**************************************************************************/
+void remove_ggz_input(void)
+{
+  /* PORTME */
+}
+
+/**************************************************************************
   Set one of the unit icons in the information area based on punit.
   NULL will be pased to clear the icon. idx==-1 will be passed to
   indicate this is the active unit, or idx in [0..num_units_below-1] for
Index: client/gui-stub/gui_main.c
===================================================================
--- client/gui-stub/gui_main.c  (revision 11429)
+++ client/gui-stub/gui_main.c  (working copy)
@@ -113,6 +113,23 @@
 }
 
 /**************************************************************************
+  Called to monitor a GGZ socket.
+**************************************************************************/
+void add_ggz_input(int sock)
+{
+  /* PORTME */
+}
+
+/**************************************************************************
+  Called on disconnection to remove monitoring on the GGZ socket.  Only
+  call this if we're actually in GGZ mode.
+**************************************************************************/
+void remove_ggz_input(void)
+{
+  /* PORTME */
+}
+
+/**************************************************************************
   Set one of the unit icons (specified by idx) in the information area
   based on punit.
 
Index: client/clinet.c
===================================================================
--- client/clinet.c     (revision 11429)
+++ client/clinet.c     (working copy)
@@ -101,6 +101,9 @@
 **************************************************************************/
 static void close_socket_nomessage(struct connection *pc)
 {
+  if (with_ggz) {
+    remove_ggz_input();
+  }
   connection_common_close(pc);
   remove_net_input();
   popdown_races_dialog(); 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#15111) ggz_remove_input function, Jason Short <=