tIncorrect handling of WM_CLOSE under Win32 fixed. - vaccinewars - be a doctor … | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit a907da82b3c3524cd5c05a189fb87a60b8aa6d96 | |
parent 720fcc153eaa520911edd6763d282fe9341e6962 | |
Author: Ben Webb <[email protected]> | |
Date: Sun, 3 Mar 2002 20:27:45 +0000 | |
Incorrect handling of WM_CLOSE under Win32 fixed. | |
Diffstat: | |
M ChangeLog | 3 +++ | |
M src/gtkport/clist.c | 7 ++++--- | |
M src/gtkport/gtkport.c | 44 ++++++++++++++++++++---------… | |
M src/gtkport/gtkport.h | 2 +- | |
4 files changed, 36 insertions(+), 20 deletions(-) | |
--- | |
diff --git a/ChangeLog b/ChangeLog | |
t@@ -1,4 +1,7 @@ | |
cvs | |
+ - Incorrect handling of WM_CLOSE under Win32 fixed | |
+ | |
+1.5.4 03-03-2002 | |
- Basic configuration file editor added to GTK+ client | |
- Annoying flashing on closure of modal windows in Win32 fixed | |
- Win32 client now uses "proper" dialog boxes (i.e. without a window menu) | |
diff --git a/src/gtkport/clist.c b/src/gtkport/clist.c | |
t@@ -39,7 +39,7 @@ static void gtk_clist_size_request(GtkWidget *widget, | |
static void gtk_clist_set_size(GtkWidget *widget, | |
GtkAllocation *allocation); | |
static gboolean gtk_clist_wndproc(GtkWidget *widget, UINT msg, WPARAM wParam, | |
- LPARAM lParam); | |
+ LPARAM lParam, gboolean *dodef); | |
static void gtk_clist_realize(GtkWidget *widget); | |
static void gtk_clist_show(GtkWidget *widget); | |
static void gtk_clist_hide(GtkWidget *widget); | |
t@@ -70,7 +70,7 @@ static GtkClass GtkCListClass = { | |
}; | |
gboolean gtk_clist_wndproc(GtkWidget *widget, UINT msg, WPARAM wParam, | |
- LPARAM lParam) | |
+ LPARAM lParam, gboolean *dodef) | |
{ | |
LPDRAWITEMSTRUCT lpdis; | |
HD_NOTIFY FAR *phdr; | |
t@@ -103,7 +103,8 @@ gboolean gtk_clist_wndproc(GtkWidget *widget, UINT msg, WP… | |
} | |
break; | |
} | |
- return TRUE; | |
+ | |
+ return FALSE; | |
} | |
void gtk_clist_set_size(GtkWidget *widget, GtkAllocation *allocation) | |
diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c | |
t@@ -89,7 +89,7 @@ static void gtk_window_destroy(GtkWidget *widget); | |
static void gtk_window_set_menu(GtkWindow *window, GtkMenuBar *menu_bar); | |
static GtkWidget *gtk_window_get_menu_ID(GtkWindow *window, gint ID); | |
static gboolean gtk_window_wndproc(GtkWidget *widget, UINT msg, WPARAM wParam, | |
- LPARAM lParam); | |
+ LPARAM lParam, gboolean *dodef); | |
static void gtk_table_destroy(GtkWidget *widget); | |
static void gtk_table_size_request(GtkWidget *widget, | |
GtkRequisition *requisition); | |
t@@ -885,7 +885,7 @@ LRESULT CALLBACK GtkSepProc(HWND hwnd, UINT msg, UINT wPar… | |
} | |
gboolean gtk_window_wndproc(GtkWidget *widget, UINT msg, WPARAM wParam, | |
- LPARAM lParam) | |
+ LPARAM lParam, gboolean *dodef) | |
{ | |
RECT rect; | |
GtkAllocation alloc; | |
t@@ -925,6 +925,7 @@ gboolean gtk_window_wndproc(GtkWidget *widget, UINT msg, W… | |
case WM_CLOSE: | |
gtk_signal_emit(GTK_OBJECT(widget), "delete_event", | |
&event, &signal_return); | |
+ *dodef = FALSE; | |
return TRUE; | |
case WM_COMMAND: | |
if (HIWORD(wParam) == 0 || HIWORD(wParam) == 1) { | |
t@@ -936,10 +937,12 @@ gboolean gtk_window_wndproc(GtkWidget *widget, UINT msg,… | |
} | |
break; | |
} | |
- return TRUE; | |
+ | |
+ return FALSE; | |
} | |
-static BOOL HandleWinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |
+static BOOL HandleWinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, | |
+ gboolean *dodef) | |
{ | |
GtkWidget *widget; | |
GtkClass *klass; | |
t@@ -949,6 +952,9 @@ static BOOL HandleWinMessage(HWND hwnd, UINT msg, WPARAM w… | |
LPDRAWITEMSTRUCT lpdis; | |
HD_NOTIFY FAR *phdr; | |
NMHDR *nmhdr; | |
+ gboolean retval = FALSE; | |
+ | |
+ *dodef = TRUE; | |
if (customWndProc | |
&& CallWindowProc(customWndProc, hwnd, msg, wParam, lParam)) | |
t@@ -956,8 +962,8 @@ static BOOL HandleWinMessage(HWND hwnd, UINT msg, WPARAM w… | |
widget = GTK_WIDGET(GetWindowLong(hwnd, GWL_USERDATA)); | |
if (widget && (klass = GTK_OBJECT(widget)->klass) | |
- && klass->wndproc && !klass->wndproc(widget, msg, wParam, lParam)) { | |
- return FALSE; | |
+ && klass->wndproc) { | |
+ retval = klass->wndproc(widget, msg, wParam, lParam, dodef); | |
} | |
switch (msg) { | |
t@@ -965,8 +971,8 @@ static BOOL HandleWinMessage(HWND hwnd, UINT msg, WPARAM w… | |
if ((lpdis = (LPDRAWITEMSTRUCT)lParam) | |
&& (widget = GTK_WIDGET(GetWindowLong(lpdis->hwndItem, GWL_USERDATA))) | |
&& (klass = GTK_OBJECT(widget)->klass) | |
- && klass->wndproc && !klass->wndproc(widget, msg, wParam, lParam)) { | |
- return FALSE; | |
+ && klass->wndproc) { | |
+ retval = klass->wndproc(widget, msg, wParam, lParam, dodef); | |
} | |
break; | |
case WM_MEASUREITEM: | |
t@@ -984,8 +990,8 @@ static BOOL HandleWinMessage(HWND hwnd, UINT msg, WPARAM w… | |
widget = GTK_WIDGET(GetWindowLong((HWND)lParam, GWL_USERDATA)); | |
klass = NULL; | |
if (widget && (klass = GTK_OBJECT(widget)->klass) | |
- && klass->wndproc && !klass->wndproc(widget, msg, wParam, lParam)) { | |
- return FALSE; | |
+ && klass->wndproc) { | |
+ retval = klass->wndproc(widget, msg, wParam, lParam, dodef); | |
} | |
if (lParam && klass == &GtkOptionMenuClass && | |
t@@ -1004,8 +1010,8 @@ static BOOL HandleWinMessage(HWND hwnd, UINT msg, WPARAM… | |
widget = GTK_WIDGET(GetWindowLong(nmhdr->hwndFrom, GWL_USERDATA)); | |
if (widget && (klass = GTK_OBJECT(widget)->klass) | |
- && klass->wndproc && !klass->wndproc(widget, msg, wParam, lParam)) { | |
- return FALSE; | |
+ && klass->wndproc) { | |
+ retval = klass->wndproc(widget, msg, wParam, lParam, dodef); | |
} | |
if (widget && nmhdr->code == TCN_SELCHANGE) { | |
t@@ -1027,24 +1033,30 @@ static BOOL HandleWinMessage(HWND hwnd, UINT msg, WPAR… | |
DispatchTimeoutEvent((UINT)wParam); | |
return FALSE; | |
} | |
- return FALSE; | |
+ | |
+ return retval; | |
} | |
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |
{ | |
- if (!HandleWinMessage(hwnd, msg, wParam, lParam)) { | |
+ gboolean retval, dodef = TRUE; | |
+ | |
+ retval = HandleWinMessage(hwnd, msg, wParam, lParam, &dodef); | |
+ if (dodef) { | |
return DefWindowProc(hwnd, msg, wParam, lParam); | |
} else { | |
- return TRUE; | |
+ return retval; | |
} | |
} | |
BOOL APIENTRY MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |
{ | |
+ gboolean dodef; | |
+ | |
if (msg == WM_INITDIALOG) { | |
return TRUE; | |
} else { | |
- return HandleWinMessage(hwnd, msg, wParam, lParam); | |
+ return HandleWinMessage(hwnd, msg, wParam, lParam, &dodef); | |
} | |
} | |
diff --git a/src/gtkport/gtkport.h b/src/gtkport/gtkport.h | |
t@@ -157,7 +157,7 @@ struct _GtkSignalType { | |
}; | |
typedef gboolean (*GtkWndProc) (GtkWidget *widget, UINT msg, | |
- WPARAM wParam, LPARAM lParam); | |
+ WPARAM wParam, LPARAM lParam, gboolean *dodef); | |
struct _GtkClass { | |
gchar *Name; |