#endif
static void
+finalize_destroy_window (void *win)
+{
+ DestroyWindow ((HWND) win);
+}
+
+static void
mswindows_finalize_image_instance (Lisp_Image_Instance *p)
{
if (!p->data)
#endif
if (IMAGE_INSTANCE_SUBWINDOW_ID (p))
{
- DestroyWindow (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p));
- DestroyWindow (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p));
+ /* DestroyWindow is not safe here, as it will send messages
+ to our window proc. */
+ register_post_gc_action
+ (finalize_destroy_window,
+ (void *) (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p)));
+ register_post_gc_action
+ (finalize_destroy_window,
+ (void *) (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p)));
IMAGE_INSTANCE_SUBWINDOW_ID (p) = 0;
}
}
0, 0, 0, 0,
SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE
| SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOACTIVATE);
+
+ /* Doing this once does not seem to be enough, for instance when
+ mapping the search dialog this gets called four times. If we
+ only set on the first time through then the subwindow never
+ gets focus as intended. However, doing this everytime doesn't
+ seem so bad, after all we only need to redo this after the
+ focus changes - and if that happens resetting the initial
+ focus doesn't seem so bad. */
+ if (IMAGE_INSTANCE_WANTS_INITIAL_FOCUS (p))
+ SetFocus (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p));
#endif
}
}
SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
WM_SETTEXT, 0, (LPARAM)lparam);
}
+ /* Set active state. */
+ if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
+ {
+ Lisp_Object item = IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (p);
+ LONG style = GetWindowLong
+ (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
+ GWL_STYLE);
+
+ if (CONSP (item))
+ item = XCAR (item);
+
+ if (gui_item_active_p (item))
+ SetWindowLong (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
+ GWL_STYLE, style & ~WS_DISABLED);
+ else
+ SetWindowLong (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
+ GWL_STYLE, style | WS_DISABLED);
+ }
}
/* register widgets into our hashtable so that we can cope with the
SendMessage (wnd, WM_SETFONT,
(WPARAM) mswindows_widget_hfont (ii, domain),
MAKELPARAM (TRUE, 0));
-#if 0
- /* #### doesn't work. need to investigate more closely. */
- if (IMAGE_INSTANCE_WANTS_INITIAL_FOCUS (ii))
- SetFocus (wnd);
-#endif
}
/* Instantiate a native layout widget. */
/* This function can call lisp */
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
HWND wnd;
- int flags = WS_TABSTOP;/* BS_NOTIFY #### is needed to get exotic feedback
- only. Since we seem to want nothing beyond BN_CLICK,
- the style is perhaps not necessary -- kkm */
+ int flags = WS_TABSTOP | BS_NOTIFY;
+ /* BS_NOTIFY #### is needed to get exotic feedback only. Since we
+ seem to want nothing beyond BN_CLICK, the style is perhaps not
+ necessary -- kkm */
Lisp_Object style;
Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
Lisp_Gui_Item* pgui = XGUI_ITEM (gui);
IMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (ii))
{
HWND wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
- int i = 0, selected = 0;
+ int i = 0, selected_idx = 0;
Lisp_Object rest;
assert (!NILP (IMAGE_INSTANCE_WIDGET_ITEMS (ii)));
add_tab_item (image_instance, wnd, XCAR (rest),
IMAGE_INSTANCE_FRAME (ii), i);
if (gui_item_selected_p (XCAR (rest)))
- selected = i;
+ selected_idx = i;
i++;
}
- SendMessage (wnd, TCM_SETCURSEL, selected, 0);
+ SendMessage (wnd, TCM_SETCURSEL, selected_idx, 0);
}
}
}