aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2001-11-28 20:31:43 +0000
committerJason Rumney2001-11-28 20:31:43 +0000
commit1c5acb8c6d238498d78f427b7ea2c2682dc191e0 (patch)
tree558b83547eaf61ad0c9d93af0ed9203988861415 /src
parentea17b6e15b876498664671a1f727b9bd2d8f0b6c (diff)
downloademacs-1c5acb8c6d238498d78f427b7ea2c2682dc191e0.tar.gz
emacs-1c5acb8c6d238498d78f427b7ea2c2682dc191e0.zip
(add_menu_item): Do not use owner-draw for disabled menu items.
From David Ponce <dponce@wanadoo.fr>. (w32_dialog_show) [HAVE_DIALOGS]: Compile whole function conditionally. (w32_menu_display_help): New argument OWNER. Rewritten to store a help event in the owner frame's keyboard buffer.
Diffstat (limited to 'src')
-rw-r--r--src/w32menu.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/w32menu.c b/src/w32menu.c
index 101f4b33a6f..bc6c9c0a96d 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -140,7 +140,9 @@ void set_frame_menubar ();
140static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, 140static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
141 Lisp_Object, Lisp_Object, Lisp_Object, 141 Lisp_Object, Lisp_Object, Lisp_Object,
142 Lisp_Object, Lisp_Object)); 142 Lisp_Object, Lisp_Object));
143#ifdef HAVE_DIALOGS
143static Lisp_Object w32_dialog_show (); 144static Lisp_Object w32_dialog_show ();
145#endif
144static Lisp_Object w32_menu_show (); 146static Lisp_Object w32_menu_show ();
145 147
146static void keymap_panes (); 148static void keymap_panes ();
@@ -2075,7 +2077,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
2075 else 2077 else
2076 out_string = wv->name; 2078 out_string = wv->name;
2077 2079
2078 if (wv->title || wv->call_data == 0) 2080 if (wv->title)
2079 { 2081 {
2080#if 0 /* no GC while popup menu is active */ 2082#if 0 /* no GC while popup menu is active */
2081 out_string = LocalAlloc (0, strlen (wv->name) + 1); 2083 out_string = LocalAlloc (0, strlen (wv->name) + 1);
@@ -2083,6 +2085,9 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
2083#endif 2085#endif
2084 fuFlags = MF_OWNERDRAW | MF_DISABLED; 2086 fuFlags = MF_OWNERDRAW | MF_DISABLED;
2085 } 2087 }
2088 else if (wv->call_data == 0)
2089 fuFlags |= MF_DISABLED;
2090
2086 /* Draw radio buttons and tickboxes. */ 2091 /* Draw radio buttons and tickboxes. */
2087 else if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || 2092 else if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE ||
2088 wv->button_type == BUTTON_TYPE_RADIO)) 2093 wv->button_type == BUTTON_TYPE_RADIO))
@@ -2178,41 +2183,35 @@ popup_activated ()
2178void 2183void
2179w32_menu_display_help (HMENU menu, UINT item, UINT flags) 2184w32_menu_display_help (HMENU menu, UINT item, UINT flags)
2180{ 2185{
2181 int pane = 0; /* TODO: Set this to pane number. */
2182
2183 HMODULE user32 = GetModuleHandle ("user32.dll"); 2186 HMODULE user32 = GetModuleHandle ("user32.dll");
2184 FARPROC get_menu_item_info = GetProcAddress (user32, "GetMenuItemInfoA"); 2187 FARPROC get_menu_item_info = GetProcAddress (user32, "GetMenuItemInfoA");
2185 2188
2186 if (get_menu_item_info) 2189 if (get_menu_item_info)
2187 { 2190 {
2188 extern Lisp_Object Qmenu_item;
2189 Lisp_Object *first_item;
2190 Lisp_Object pane_name;
2191 Lisp_Object menu_object;
2192 MENUITEMINFO info; 2191 MENUITEMINFO info;
2192 struct frame *f = x_window_to_frame (&one_w32_display_info, owner);
2193 Lisp_Object frame, help;
2193 2194
2194 bzero (&info, sizeof (info)); 2195 bzero (&info, sizeof (info));
2195 info.cbSize = sizeof (info); 2196 info.cbSize = sizeof (info);
2196 info.fMask = MIIM_DATA; 2197 info.fMask = MIIM_DATA;
2197 get_menu_item_info (menu, item, FALSE, &info); 2198 get_menu_item_info (menu, item, FALSE, &info);
2198 2199
2199 first_item = XVECTOR (menu_items)->contents; 2200 help = info.dwItemData ? build_string ((char *)info.dwItemData) : Qnil;
2200 if (EQ (first_item[0], Qt))
2201 pane_name = first_item[MENU_ITEMS_PANE_NAME];
2202 else if (EQ (first_item[0], Qquote))
2203 /* This shouldn't happen, see w32_menu_show. */
2204 pane_name = empty_string;
2205 else
2206 pane_name = first_item[MENU_ITEMS_ITEM_NAME];
2207 2201
2208 /* (menu-item MENU-NAME PANE-NUMBER) */ 2202 /* Store the help echo in the keyboard buffer as the X toolkit
2209 menu_object = Fcons (Qmenu_item, 2203 version does, rather than directly showing it. This seems to
2210 Fcons (pane_name, 2204 solve the GC problems that were present when we based the
2211 Fcons (make_number (pane), Qnil))); 2205 Windows code on the non-toolkit version. */
2212 2206 if (f)
2213 show_help_echo (info.dwItemData ? 2207 {
2214 build_string ((char *) info.dwItemData) : Qnil, 2208 XSETFRAME (frame, f);
2215 Qnil, menu_object, make_number (item), 1); 2209 kbd_buffer_store_help_event (frame, help);
2210 }
2211 else
2212 /* X version has a loop through frames here, which doesn't
2213 appear to do anything, unless it has some side effect. */
2214 show_help_echo (help, Qnil, Qnil, Qnil, 1);
2216 } 2215 }
2217} 2216}
2218 2217