tAll non-toplevel windows (i.e. dialogs) under Win32 are now created using the "proper" Win32 function, CreateDialog, and no longer have window menus. - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ebe3f9ffc55e1ed790df4595d3cbd1de6a6efd7b
(DIR) parent e45ebe6c4ada3efb0306cb766a7d7635dcc42c8f
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Sat, 2 Mar 2002 18:52:18 +0000
All non-toplevel windows (i.e. dialogs) under Win32 are now created using
tthe "proper" Win32 function, CreateDialog, and no longer have window menus.
Diffstat:
M src/dopewars.rc | 8 ++++++++
M src/gtkport/gtkport.c | 42 +++++++++++++++++++++----------
2 files changed, 37 insertions(+), 13 deletions(-)
---
(DIR) diff --git a/src/dopewars.rc b/src/dopewars.rc
t@@ -1 +1,9 @@
+#include <windows.h>
+
mainicon ICON pill.ico
+
+gtkdialog DIALOG 40, 40, 40, 40
+STYLE WS_POPUP | WS_CAPTION | WS_THICKFRAME | DS_MODALFRAME
+CAPTION ""
+BEGIN
+END
(DIR) diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c
t@@ -902,6 +902,8 @@ gboolean gtk_window_wndproc(GtkWidget *widget, UINT msg, WPARAM wParam,
alloc.height = rect.bottom - rect.top;
gtk_window_handle_user_size(GTK_WINDOW(widget), &alloc);
gtk_widget_set_size(widget, &alloc);
+ InvalidateRect(widget->hWnd, NULL, TRUE);
+ UpdateWindow(widget->hWnd);
return FALSE;
case WM_GETMINMAXINFO:
gtk_window_handle_minmax_size(GTK_WINDOW(widget), (LPMINMAXINFO)lParam);
t@@ -937,7 +939,7 @@ gboolean gtk_window_wndproc(GtkWidget *widget, UINT msg, WPARAM wParam,
return TRUE;
}
-LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
+static BOOL HandleWinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
GtkWidget *widget;
GtkClass *klass;
t@@ -1024,12 +1026,28 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
case WM_TIMER:
DispatchTimeoutEvent((UINT)wParam);
return FALSE;
- default:
- return DefWindowProc(hwnd, msg, wParam, lParam);
}
return FALSE;
}
+LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ if (!HandleWinMessage(hwnd, msg, wParam, lParam)) {
+ return DefWindowProc(hwnd, msg, wParam, lParam);
+ } else {
+ return TRUE;
+ }
+}
+
+BOOL APIENTRY MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ if (msg == WM_INITDIALOG) {
+ return TRUE;
+ } else {
+ return HandleWinMessage(hwnd, msg, wParam, lParam);
+ }
+}
+
LRESULT APIENTRY EntryWndProc(HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam)
{
t@@ -1083,7 +1101,7 @@ void win32_init(HINSTANCE hInstance, HINSTANCE hPrevInstance,
mainIcon = LoadIcon(NULL, IDI_APPLICATION);
}
if (!hPrevInstance) {
- wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.style = 0;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
t@@ -1095,7 +1113,7 @@ void win32_init(HINSTANCE hInstance, HINSTANCE hPrevInstance,
wc.lpszClassName = "mainwin";
RegisterClass(&wc);
- wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.style = 0;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
t@@ -1107,7 +1125,7 @@ void win32_init(HINSTANCE hInstance, HINSTANCE hPrevInstance,
wc.lpszClassName = WC_GTKDIALOG;
RegisterClass(&wc);
- wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.style = 0;
wc.lpfnWndProc = GtkPanedProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
t@@ -1119,7 +1137,7 @@ void win32_init(HINSTANCE hInstance, HINSTANCE hPrevInstance,
wc.lpszClassName = WC_GTKHPANED;
RegisterClass(&wc);
- wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.style = 0;
wc.lpfnWndProc = GtkPanedProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
t@@ -1131,7 +1149,7 @@ void win32_init(HINSTANCE hInstance, HINSTANCE hPrevInstance,
wc.lpszClassName = WC_GTKVPANED;
RegisterClass(&wc);
- wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.style = 0;
wc.lpfnWndProc = GtkSepProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
t@@ -1143,7 +1161,7 @@ void win32_init(HINSTANCE hInstance, HINSTANCE hPrevInstance,
wc.lpszClassName = WC_GTKSEP;
RegisterClass(&wc);
- wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.style = 0;
wc.lpfnWndProc = GtkUrlProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
t@@ -2272,10 +2290,8 @@ void gtk_window_realize(GtkWidget *widget)
if (!TopLevel)
TopLevel = widget->hWnd;
} else {
- widget->hWnd = CreateWindow(WC_GTKDIALOG, win->title,
- WS_CAPTION | WS_SYSMENU | CS_HREDRAW |
- CS_VREDRAW | resize, CW_USEDEFAULT, 0, 0,
- 0, Parent, NULL, hInst, NULL);
+ widget->hWnd = CreateDialog(hInst, "gtkdialog", Parent, MainDlgProc);
+ SetWindowText(widget->hWnd, win->title);
}
WindowList = g_slist_append(WindowList, (gpointer)win);
gtk_set_default_font(widget->hWnd);