Clone of mesa.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

mwmborder.c 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* mwmborder.c */
  2. /*
  3. * This function shows how to remove the border, title bar, resize button,
  4. * etc from a Motif window frame from inside an Xlib-based application.
  5. *
  6. * Brian Paul 19 Sep 1995 brianp@ssec.wisc.edu
  7. *
  8. * This code is in the public domain.
  9. */
  10. #include <X11/Xlib.h>
  11. #include <X11/Xatom.h>
  12. #define HAVE_MOTIF
  13. #ifdef HAVE_MOTIF
  14. #include <X11/Xm/MwmUtil.h>
  15. #else
  16. /* bit definitions for MwmHints.flags */
  17. #define MWM_HINTS_FUNCTIONS (1L << 0)
  18. #define MWM_HINTS_DECORATIONS (1L << 1)
  19. #define MWM_HINTS_INPUT_MODE (1L << 2)
  20. #define MWM_HINTS_STATUS (1L << 3)
  21. /* bit definitions for MwmHints.decorations */
  22. #define MWM_DECOR_ALL (1L << 0)
  23. #define MWM_DECOR_BORDER (1L << 1)
  24. #define MWM_DECOR_RESIZEH (1L << 2)
  25. #define MWM_DECOR_TITLE (1L << 3)
  26. #define MWM_DECOR_MENU (1L << 4)
  27. #define MWM_DECOR_MINIMIZE (1L << 5)
  28. #define MWM_DECOR_MAXIMIZE (1L << 6)
  29. typedef struct
  30. {
  31. unsigned long flags;
  32. unsigned long functions;
  33. unsigned long decorations;
  34. long inputMode;
  35. unsigned long status;
  36. } PropMotifWmHints;
  37. #define PROP_MOTIF_WM_HINTS_ELEMENTS 5
  38. #endif
  39. /*
  40. * Specify which Motif window manager border decorations to put on a
  41. * top-level window. For example, you can specify that a window is not
  42. * resizabe, or omit the titlebar, or completely remove all decorations.
  43. * Input: dpy - the X display
  44. * w - the X window
  45. * flags - bitwise-OR of the MWM_DECOR_xxx symbols in X11/Xm/MwmUtil.h
  46. * indicating what decoration elements to enable. Zero would
  47. * be no decoration.
  48. */
  49. void set_mwm_border( Display *dpy, Window w, unsigned long flags )
  50. {
  51. PropMotifWmHints motif_hints;
  52. Atom prop, proptype;
  53. /* setup the property */
  54. motif_hints.flags = MWM_HINTS_DECORATIONS;
  55. motif_hints.decorations = flags;
  56. /* get the atom for the property */
  57. prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True );
  58. if (!prop) {
  59. /* something went wrong! */
  60. return;
  61. }
  62. /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */
  63. proptype = prop;
  64. XChangeProperty( dpy, w, /* display, window */
  65. prop, proptype, /* property, type */
  66. 32, /* format: 32-bit datums */
  67. PropModeReplace, /* mode */
  68. (unsigned char *) &motif_hints, /* data */
  69. PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */
  70. );
  71. }