comparison src/menubar-msw.c @ 269:b2472a1930f2 r20-5b33

Import from CVS: tag r20-5b33
author cvs
date Mon, 13 Aug 2007 10:27:19 +0200
parents 084402c475ba
children c5d627a313b1
comparison
equal deleted inserted replaced
268:6ced69ccd85f 269:b2472a1930f2
90 #include "menubar.h" 90 #include "menubar.h"
91 #include "menubar-msw.h" 91 #include "menubar-msw.h"
92 #include "opaque.h" 92 #include "opaque.h"
93 #include "window.h" 93 #include "window.h"
94 94
95 /* #### */
96 #define REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH 0
97
95 #define EMPTY_ITEM_ID ((UINT)LISP_TO_VOID (Qunbound)) 98 #define EMPTY_ITEM_ID ((UINT)LISP_TO_VOID (Qunbound))
96 #define EMPTY_ITEM_NAME "(empty)" 99 #define EMPTY_ITEM_NAME "(empty)"
97 100
98 /* Current menu (bar or popup) descriptor. gcpro'ed */ 101 /* Current menu (bar or popup) descriptor. gcpro'ed */
99 static Lisp_Object current_menudesc; 102 static Lisp_Object current_menudesc;
248 HMENU submenu; 251 HMENU submenu;
249 struct gui_item gui_item; 252 struct gui_item gui_item;
250 struct gcpro gcpro1; 253 struct gcpro gcpro1;
251 254
252 gui_item_init (&gui_item); 255 gui_item_init (&gui_item);
253 GCPRO1 (gui_item); 256 GCPRO_GUI_ITEM (&gui_item);
254 gcpro1.nvars = GUI_ITEM_GCPRO_COUNT;
255 257
256 menu_parse_submenu_keywords (item, &gui_item); 258 menu_parse_submenu_keywords (item, &gui_item);
257 259
258 if (!STRINGP (gui_item.name)) 260 if (!STRINGP (gui_item.name))
259 signal_simple_error ("Menu name (first element) must be a string", item); 261 signal_simple_error ("Menu name (first element) must be a string", item);
297 Lisp_Object style, id; 299 Lisp_Object style, id;
298 struct gui_item gui_item; 300 struct gui_item gui_item;
299 struct gcpro gcpro1; 301 struct gcpro gcpro1;
300 302
301 gui_item_init (&gui_item); 303 gui_item_init (&gui_item);
302 GCPRO1 (gui_item); 304 GCPRO_GUI_ITEM (&gui_item);
303 gcpro1.nvars = GUI_ITEM_GCPRO_COUNT;
304 305
305 gui_parse_item_keywords (item, &gui_item); 306 gui_parse_item_keywords (item, &gui_item);
306 307
307 if (!gui_item_included_p (&gui_item, Vmenubar_configuration)) 308 if (!gui_item_included_p (&gui_item, Vmenubar_configuration))
308 return; 309 return;
360 Lisp_Object hash_tab, int bar_p, int populate_p) 361 Lisp_Object hash_tab, int bar_p, int populate_p)
361 { 362 {
362 Lisp_Object item_desc; 363 Lisp_Object item_desc;
363 int deep_p, flush_right; 364 int deep_p, flush_right;
364 struct gcpro gcpro1; 365 struct gcpro gcpro1;
365 unsigned long checksum = 0; 366 unsigned long checksum;
366 struct gui_item gui_item; 367 struct gui_item gui_item;
367 368
368 gui_item_init (&gui_item); 369 gui_item_init (&gui_item);
369 GCPRO1 (gui_item); 370 GCPRO_GUI_ITEM (&gui_item);
370 gcpro1.nvars = GUI_ITEM_GCPRO_COUNT; 371
372 /* We are sometimes called with the menubar unchanged, and with changed
373 right flush. We have to update the menubar in ths case,
374 so account for the compliance setting in the hash value */
375 checksum = REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH;
371 376
372 /* Will initially contain only "(empty)" */ 377 /* Will initially contain only "(empty)" */
373 if (populate_p) 378 if (populate_p)
374 empty_menu (menu, 1); 379 empty_menu (menu, 1);
375 380
391 flush_right = 0; 396 flush_right = 0;
392 EXTERNAL_LIST_LOOP (item_desc, desc) 397 EXTERNAL_LIST_LOOP (item_desc, desc)
393 { 398 {
394 if (NILP (XCAR (item_desc))) 399 if (NILP (XCAR (item_desc)))
395 { 400 {
396 if (bar_p) 401 /* Do not flush right menubar items when MS style compiant */
402 if (bar_p && !REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH)
397 flush_right = 1; 403 flush_right = 1;
398 if (!populate_p) 404 if (!populate_p)
399 checksum = HASH2 (checksum, Qnil); 405 checksum = HASH2 (checksum, Qnil);
400 } 406 }
401 else if (populate_p) 407 else if (populate_p)
700 /*------------------------------------------------------------------------*/ 706 /*------------------------------------------------------------------------*/
701 707
702 static void 708 static void
703 mswindows_update_frame_menubars (struct frame* f) 709 mswindows_update_frame_menubars (struct frame* f)
704 { 710 {
705 /* #### KLUDGE. menubar.c calls us when the following 711 update_frame_menubar_maybe (f);
706 condition is true:
707 (f->menubar_changed || f->windows_changed)
708 Is that much really necessary?
709 */
710 if (f->menubar_changed)
711 update_frame_menubar_maybe (f);
712 } 712 }
713 713
714 static void 714 static void
715 mswindows_free_frame_menubars (struct frame* f) 715 mswindows_free_frame_menubars (struct frame* f)
716 { 716 {