X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fglyphs-msw.c;h=72902aa3ea00d669311306feb43284b66251cce5;hb=3f711eea68ce5fd586297b43c8d9936cd2ba916f;hp=4d4a5f1761878e6e4e39e169ca11b789a891d4f3;hpb=59eec5f21669e81977b5b1fe9bf717cab49cf7fb;p=chise%2Fxemacs-chise.git.1 diff --git a/src/glyphs-msw.c b/src/glyphs-msw.c index 4d4a5f1..72902aa 100644 --- a/src/glyphs-msw.c +++ b/src/glyphs-msw.c @@ -1460,7 +1460,7 @@ in this Software without prior written authorization from the X Consortium. /* shared data for the image read/parse logic */ static short hexTable[256]; /* conversion value */ -static int initialized = FALSE; /* easier to fill in at run time */ +static int hex_initialized = FALSE; /* easier to fill in at run time */ /* * Table index for the hex values. Initialized once, first time. @@ -1494,7 +1494,7 @@ initHexTable (void) hexTable['}'] = -1; hexTable['\n'] = -1; hexTable['\t'] = -1; - initialized = TRUE; + hex_initialized = TRUE; } /* @@ -1557,7 +1557,7 @@ int read_bitmap_data (FILE* fstream, unsigned int *width, #define Xmalloc(size) malloc(size) /* first time initialization */ - if (initialized == FALSE) initHexTable(); + if (hex_initialized == FALSE) initHexTable(); /* error cleanup and return macro */ #define RETURN(code) { if (data) free (data); return code; } @@ -1720,9 +1720,9 @@ xbm_create_bitmap_from_data (HDC hdc, char *data, for (j=0; j> 4]); + ((flip_table[bite & 0xf] << 4) + flip_table[bite >> 4]); } } @@ -1903,7 +1903,7 @@ init_image_instance_from_xbm_inline (Lisp_Image_Instance *ii, break; default: - abort (); + ABORT (); } } @@ -1977,6 +1977,9 @@ mswindows_xbm_instantiate (Lisp_Object image_instance, #ifdef __cplusplus extern "C" { #endif +#ifndef __STDC__ /* Needed to avoid prototype warnings */ +#define __STDC__ +#endif #include #ifdef __cplusplus } @@ -2091,6 +2094,12 @@ extern int debug_widget_instances; #endif static void +finalize_destroy_window (void *win) +{ + DestroyWindow ((HWND) win); +} + +static void mswindows_finalize_image_instance (Lisp_Image_Instance *p) { if (!p->data) @@ -2107,8 +2116,14 @@ mswindows_finalize_image_instance (Lisp_Image_Instance *p) #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; } } @@ -2264,6 +2279,16 @@ mswindows_map_subwindow (Lisp_Image_Instance *p, int x, int y, 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 } } @@ -2326,6 +2351,31 @@ mswindows_redisplay_widget (Lisp_Image_Instance *p) 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); + } +} + +/* Account for some of the limitations with widget images. */ +static int +mswindows_widget_border_width (void) +{ + return DEFAULT_WIDGET_BORDER_WIDTH; } /* register widgets into our hashtable so that we can cope with the @@ -2558,11 +2608,6 @@ mswindows_widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiat 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. */ @@ -2601,9 +2646,10 @@ mswindows_button_instantiate (Lisp_Object image_instance, Lisp_Object instantiat /* 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); @@ -2934,7 +2980,7 @@ mswindows_tab_control_redisplay (Lisp_Object image_instance) 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))); @@ -2987,10 +3033,10 @@ mswindows_tab_control_redisplay (Lisp_Object image_instance) 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); } } } @@ -3042,7 +3088,7 @@ mswindows_combo_box_instantiate (Lisp_Object image_instance, Lisp_Object instant default_face_font_info (domain, 0, 0, &height, 0, 0); GET_LIST_LENGTH (items, len); - height = (height + WIDGET_BORDER_HEIGHT * 2 ) * len; + height = (height + DEFAULT_WIDGET_BORDER_WIDTH * 2 ) * len; IMAGE_INSTANCE_HEIGHT (ii) = height; /* Now create the widget. */ @@ -3200,6 +3246,7 @@ console_type_create_glyphs_mswindows (void) CONSOLE_HAS_METHOD (mswindows, image_instance_hash); CONSOLE_HAS_METHOD (mswindows, init_image_instance_from_eimage); CONSOLE_HAS_METHOD (mswindows, locate_pixmap_file); + CONSOLE_HAS_METHOD (mswindows, widget_border_width); /* image methods - printer */ CONSOLE_INHERITS_METHOD (msprinter, mswindows, print_image_instance);