tWindows graphical server can now be minimized to the System Tray - vaccinewars - be a doctor and try to vaccinate the world
git clone git://src.adamsgaard.dk/vaccinewars
Log
Files
Refs
README
LICENSE
---
commit 90d8f34b97c10f9bc8a78931293d1597b439fba0
parent 9ca101a62654cbc527b08a96d8ca5e0e9e1692cc
Author: Ben Webb 
Date:   Mon, 22 Oct 2001 20:58:00 +0000

Windows graphical server can now be minimized to the System Tray


Diffstat:
  M ChangeLog                           |       1 +
  M src/gtkport.c                       |      26 ++++++++++++++++++--------
  M src/gtkport.h                       |       6 ++++++

3 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
t@@ -1,4 +1,5 @@
 cvs
+    - Windows graphical server can be minimized to the System Tray
     - Keyboard shortcuts for menu items in Windows client
     - Default buttons for Windows client, bank bug (hopefully) fixed
     - RPM build/make install can now be run as non-superuser
diff --git a/src/gtkport.c b/src/gtkport.c
t@@ -42,7 +42,8 @@
 
 #define PANED_STARTPOS 200
 
-#define WM_SOCKETDATA (WM_USER+100)
+HICON mainIcon=NULL;
+static WNDPROC customWndProc=NULL;
 
 static gint RecurseLevel=0;
 
t@@ -836,6 +837,9 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,UINT wParam,LONG lParam) {
    LPDRAWITEMSTRUCT lpdis;
    HD_NOTIFY FAR* phdr;
    NMHDR *nmhdr;
+   if (customWndProc &&
+       CallWindowProc(customWndProc,hwnd,msg,wParam,lParam)) return TRUE;
+
    switch(msg) {
       case WM_SIZE:
          window=GTK_WIDGET(GetWindowLong(hwnd,GWL_USERDATA));
t@@ -925,7 +929,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,UINT wParam,LONG lParam) {
             return FALSE;
          }
          break;
-      case WM_SOCKETDATA:
+      case MYWM_SOCKETDATA:
 /* Ignore network messages if in recursive message loops, to avoid dodgy
    race conditions */
          if (RecurseLevel<=1) {
t@@ -966,23 +970,29 @@ LRESULT APIENTRY TextWndProc(HWND hwnd,UINT msg,WPARAM wParam,
    return CallWindowProc(wpOrigTextProc,hwnd,msg,wParam,lParam);
 }
 
+void SetCustomWndProc(WNDPROC wndproc) {
+  customWndProc = wndproc;
+}
+
 void win32_init(HINSTANCE hInstance,HINSTANCE hPrevInstance,char *MainIcon) {
    WNDCLASS wc;
    hInst=hInstance;
    hFont=(HFONT)GetStockObject(DEFAULT_GUI_FONT);
    WindowList=NULL;
    RecurseLevel=0;
+   customWndProc = NULL;
+   if (MainIcon) {
+     mainIcon        = LoadIcon(hInstance,MainIcon);
+   } else {
+     mainIcon        = LoadIcon(NULL,IDI_APPLICATION);
+   }
    if (!hPrevInstance) {
       wc.style                = CS_HREDRAW|CS_VREDRAW;
       wc.lpfnWndProc        = MainWndProc;
       wc.cbClsExtra        = 0;
       wc.cbWndExtra        = 0;
       wc.hInstance        = hInstance;
-      if (MainIcon) {
-        wc.hIcon        = LoadIcon(hInstance,MainIcon);
-      } else {
-        wc.hIcon        = LoadIcon(NULL,IDI_APPLICATION);
-      }
+      wc.hIcon = mainIcon;
       wc.hCursor        = LoadCursor(NULL,IDC_ARROW);
       wc.hbrBackground        = (HBRUSH)(1+COLOR_BTNFACE);
       wc.lpszMenuName        = NULL;
t@@ -3816,7 +3826,7 @@ gint gdk_input_add(gint source,GdkInputCondition condition,
    input->condition=condition;
    input->function=function;
    input->data=data;
-   rc=WSAAsyncSelect(source,TopLevel,WM_SOCKETDATA,
+   rc=WSAAsyncSelect(source,TopLevel,MYWM_SOCKETDATA,
                   (condition&GDK_INPUT_READ ? FD_READ|FD_CLOSE|FD_ACCEPT:0) |
                   (condition&GDK_INPUT_WRITE ? FD_WRITE|FD_CONNECT:0));
    GdkInputs=g_slist_append(GdkInputs,input);
diff --git a/src/gtkport.h b/src/gtkport.h
t@@ -35,6 +35,11 @@
 
 #define MB_IMMRETURN 0
 
+#define MYWM_SOCKETDATA (WM_USER+100)
+#define MYWM_TASKBAR    (WM_USER+101)
+
+extern HICON mainIcon;
+
 typedef enum {
    GTK_WINDOW_TOPLEVEL, GTK_WINDOW_DIALOG, GTK_WINDOW_POPUP
 } GtkWindowType;
t@@ -609,6 +614,7 @@ guint gtk_signal_connect(GtkObject *object,const gchar *name,
 guint gtk_signal_connect_object(GtkObject *object,const gchar *name,
                                 GtkSignalFunc func,GtkObject *slot_object);
 void gtk_signal_emit(GtkObject *object,const gchar *name, ...);
+void SetCustomWndProc(WNDPROC wndproc);
 void win32_init(HINSTANCE hInstance,HINSTANCE hPrevInstance,char *MainIcon);
 void gtk_menu_shell_insert(GtkMenuShell *menu_shell,GtkWidget *child,
                            gint position);