Mercurial > hg > xemacs-beta
comparison lwlib/xlwmenu.c @ 219:262b8bb4a523 r20-4b8
Import from CVS: tag r20-4b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:09:35 +0200 |
parents | d44af0c54775 |
children | 41f2f0e326e9 |
comparison
equal
deleted
inserted
replaced
218:c9f226976f56 | 219:262b8bb4a523 |
---|---|
36 | 36 |
37 #if 0 /* mrb */ | 37 #if 0 /* mrb */ |
38 #include <X11/Xos.h> | 38 #include <X11/Xos.h> |
39 #endif | 39 #endif |
40 #include <X11/IntrinsicP.h> | 40 #include <X11/IntrinsicP.h> |
41 #include <X11/ShellP.h> | |
41 #include <X11/StringDefs.h> | 42 #include <X11/StringDefs.h> |
42 #include <X11/cursorfont.h> | 43 #include <X11/cursorfont.h> |
43 #include <X11/bitmaps/gray> | 44 #include <X11/bitmaps/gray> |
44 | 45 |
45 #ifdef NEED_MOTIF | 46 #ifdef NEED_MOTIF |
2342 make_windows_if_needed (XlwMenuWidget mw, int n) | 2343 make_windows_if_needed (XlwMenuWidget mw, int n) |
2343 { | 2344 { |
2344 int i; | 2345 int i; |
2345 int start_at; | 2346 int start_at; |
2346 XSetWindowAttributes xswa; | 2347 XSetWindowAttributes xswa; |
2348 Widget p; | |
2347 int mask; | 2349 int mask; |
2348 #define ROOT_PARENT | 2350 int depth; |
2349 #ifdef ROOT_PARENT | 2351 Visual *visual; |
2350 Window root = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw))); | |
2351 #endif | |
2352 window_state *windows; | 2352 window_state *windows; |
2353 Window root; | |
2353 | 2354 |
2354 if (mw->menu.windows_length >= n) | 2355 if (mw->menu.windows_length >= n) |
2355 return; | 2356 return; |
2357 | |
2358 root = RootWindowOfScreen (XtScreen(mw)); | |
2359 /* grab the visual and depth from the nearest shell ancestor */ | |
2360 visual = CopyFromParent; | |
2361 depth = CopyFromParent; | |
2362 p = XtParent(mw); | |
2363 while (visual == CopyFromParent && p) | |
2364 { | |
2365 if (XtIsShell(p)) | |
2366 { | |
2367 visual = ((ShellWidget)p)->shell.visual; | |
2368 depth = p->core.depth; | |
2369 } | |
2370 p = XtParent(p); | |
2371 } | |
2356 | 2372 |
2357 xswa.save_under = True; | 2373 xswa.save_under = True; |
2358 xswa.override_redirect = True; | 2374 xswa.override_redirect = True; |
2359 xswa.background_pixel = mw->core.background_pixel; | 2375 xswa.background_pixel = mw->core.background_pixel; |
2360 xswa.border_pixel = mw->core.border_pixel; | 2376 xswa.border_pixel = mw->core.border_pixel; |
2361 xswa.event_mask = (ExposureMask | ButtonMotionMask | 2377 xswa.event_mask = (ExposureMask | ButtonMotionMask |
2362 | ButtonReleaseMask | ButtonPressMask); | 2378 | ButtonReleaseMask | ButtonPressMask); |
2363 xswa.cursor = mw->menu.cursor_shape; | 2379 xswa.cursor = mw->menu.cursor_shape; |
2380 xswa.colormap = mw->core.colormap; | |
2364 mask = CWSaveUnder | CWOverrideRedirect | CWBackPixel | CWBorderPixel | 2381 mask = CWSaveUnder | CWOverrideRedirect | CWBackPixel | CWBorderPixel |
2365 | CWEventMask | CWCursor; | 2382 | CWEventMask | CWCursor | CWColormap; |
2366 | 2383 |
2367 if (mw->menu.use_backing_store) | 2384 if (mw->menu.use_backing_store) |
2368 { | 2385 { |
2369 xswa.backing_store = Always; | 2386 xswa.backing_store = Always; |
2370 mask |= CWBackingStore; | 2387 mask |= CWBackingStore; |
2393 windows [i].y = 0; | 2410 windows [i].y = 0; |
2394 windows [i].width = 1; | 2411 windows [i].width = 1; |
2395 windows [i].height = 1; | 2412 windows [i].height = 1; |
2396 windows [i].window = | 2413 windows [i].window = |
2397 XCreateWindow (XtDisplay (mw), | 2414 XCreateWindow (XtDisplay (mw), |
2398 #ifdef ROOT_PARENT | |
2399 root, | 2415 root, |
2400 #else | |
2401 ((i > 0) | |
2402 ? windows[0].window | |
2403 : XtWindow (XtParent (mw))), | |
2404 #endif | |
2405 0, 0, 1, 1, | 2416 0, 0, 1, 1, |
2406 0, 0, CopyFromParent, CopyFromParent, mask, &xswa); | 2417 0, depth, CopyFromParent, visual, mask, &xswa); |
2407 } | 2418 } |
2408 } | 2419 } |
2409 | 2420 |
2410 /* Make the window fit in the screen */ | 2421 /* Make the window fit in the screen */ |
2411 static void | 2422 static void |
2656 xgcv.foreground = mw->menu.foreground; | 2667 xgcv.foreground = mw->menu.foreground; |
2657 } | 2668 } |
2658 else | 2669 else |
2659 { /* color */ | 2670 { /* color */ |
2660 XColor xcolor; | 2671 XColor xcolor; |
2661 Colormap cmap = DefaultColormapOfScreen (XtScreen ((Widget) mw)); | 2672 Colormap cmap = mw->core.colormap; |
2662 xcolor.pixel = mw->core.background_pixel; | 2673 xcolor.pixel = mw->core.background_pixel; |
2663 XQueryColor (dpy, cmap, &xcolor); | 2674 XQueryColor (dpy, cmap, &xcolor); |
2664 xcolor.red *= 0.85; | 2675 xcolor.red *= 0.85; |
2665 xcolor.green *= 0.85; | 2676 xcolor.green *= 0.85; |
2666 xcolor.blue *= 0.85; | 2677 xcolor.blue *= 0.85; |
2727 make_shadow_gcs (XlwMenuWidget mw) | 2738 make_shadow_gcs (XlwMenuWidget mw) |
2728 { | 2739 { |
2729 XGCValues xgcv; | 2740 XGCValues xgcv; |
2730 unsigned long pm = 0; | 2741 unsigned long pm = 0; |
2731 Display *dpy = XtDisplay ((Widget) mw); | 2742 Display *dpy = XtDisplay ((Widget) mw); |
2732 Colormap cmap = DefaultColormapOfScreen (XtScreen ((Widget) mw)); | 2743 Colormap cmap = mw->core.colormap; |
2733 XColor topc, botc; | 2744 XColor topc, botc; |
2734 int top_frobbed = 0, bottom_frobbed = 0; | 2745 int top_frobbed = 0, bottom_frobbed = 0; |
2735 | 2746 |
2736 if (mw->menu.top_shadow_color == -1) | 2747 if (mw->menu.top_shadow_color == -1) |
2737 mw->menu.top_shadow_color = mw->core.background_pixel; | 2748 mw->menu.top_shadow_color = mw->core.background_pixel; |