t"activate" signal now sent properly for GtkEntry widgets under Win32 - vaccine… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit f40f0dd9b38a9fe1905d800b88b8b2679344e947 | |
parent c9aaa404745fff897e4c49c0cee598d8d72e450a | |
Author: Ben Webb <[email protected]> | |
Date: Thu, 26 Apr 2001 03:21:17 +0000 | |
"activate" signal now sent properly for GtkEntry widgets under Win32 | |
Diffstat: | |
M src/gtkport.c | 18 ++++++++++++++++++ | |
1 file changed, 18 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/src/gtkport.c b/src/gtkport.c | |
t@@ -634,6 +634,8 @@ static GSList *GtkTimeouts=NULL; | |
static HWND TopLevel=NULL; | |
long AsyncSocketError=0; | |
+static WNDPROC wpOrigEntryProc; | |
+ | |
static void gtk_set_default_font(HWND hWnd) { | |
SendMessage(hWnd,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(FALSE,0)); | |
} | |
t@@ -896,6 +898,17 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,UINT wPar… | |
return FALSE; | |
} | |
+LRESULT APIENTRY EntryWndProc(HWND hwnd,UINT msg,WPARAM wParam, | |
+ LPARAM lParam) { | |
+ GtkWidget *widget; | |
+ if (msg==WM_KEYUP && wParam==VK_RETURN) { | |
+ widget=GTK_WIDGET(GetWindowLong(hwnd,GWL_USERDATA)); | |
+ if (widget) gtk_signal_emit(GTK_OBJECT(widget),"activate"); | |
+ return FALSE; | |
+ } | |
+ return CallWindowProc(wpOrigEntryProc,hwnd,msg,wParam,lParam); | |
+} | |
+ | |
void win32_init(HINSTANCE hInstance,HINSTANCE hPrevInstance) { | |
WNDCLASS wc; | |
hInst=hInstance; | |
t@@ -1961,6 +1974,11 @@ void gtk_entry_realize(GtkWidget *widget) { | |
widget->allocation.x,widget->allocation.y, | |
widget->allocation.width,widget->allocation.height, | |
Parent,NULL,hInst,NULL); | |
+/* Subclass the window (we assume that all edit boxes have the same window | |
+ procedure) */ | |
+ wpOrigEntryProc = (WNDPROC) SetWindowLong(widget->hWnd, | |
+ GWL_WNDPROC, | |
+ (LONG)EntryWndProc); | |
gtk_set_default_font(widget->hWnd); | |
gtk_editable_set_editable(GTK_EDITABLE(widget), | |
GTK_EDITABLE(widget)->is_editable); |