SetVWmHint.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /*
  24. * (c) Copyright 1993, 1994 International Business Machines Corp. *
  25. * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
  26. * (c) Copyright 1993, 1994 Novell, Inc. *
  27. */
  28. /************************************<+>*************************************
  29. ****************************************************************************
  30. **
  31. ** File: SetVWmHint.c
  32. **
  33. ** RCS: $XConsortium: SetVWmHint.c /main/4 1995/10/26 15:11:34 rswiston $
  34. **
  35. ** Project: DT Workspace Manager
  36. **
  37. ** Description: Set Dt Wm hints.
  38. **
  39. ** (c) Copyright 1991, 1993, 1994 by Hewlett-Packard Company
  40. **
  41. ****************************************************************************
  42. ************************************<+>*************************************/
  43. #include <stdio.h>
  44. #include <X11/Xlib.h>
  45. #include <X11/Xutil.h>
  46. #include <Dt/Wsm.h>
  47. #include <Dt/WsmP.h>
  48. #include <Xm/Xm.h>
  49. #include <Xm/AtomMgr.h>
  50. /*************************************<->*************************************
  51. *
  52. * _DtWsmSetDtWmHints (display, window, pHints)
  53. *
  54. *
  55. * Description:
  56. * -----------
  57. * Set the contents of the _DT_WM_HINTS property on a window
  58. *
  59. *
  60. * Inputs:
  61. * ------
  62. * display - display
  63. * window - window to set hints on
  64. * pHints - pointer the hints to set
  65. *
  66. * Comments:
  67. * ---------
  68. * No error checking
  69. *
  70. *************************************<->***********************************/
  71. void
  72. _DtWsmSetDtWmHints(
  73. Display *display,
  74. Window window,
  75. DtWmHints *pHints)
  76. {
  77. Atom property;
  78. DtWmHints vh;
  79. property = XmInternAtom (display, _XA_DT_WM_HINTS, False);
  80. /*
  81. * Copy hints to make sure we have one of the right size.
  82. * This is for backward compatibility.
  83. */
  84. vh.flags = pHints->flags;
  85. if (pHints->flags & DtWM_HINTS_FUNCTIONS) {
  86. vh.functions = pHints->functions;
  87. } else {
  88. vh.functions = 0L;
  89. }
  90. if (pHints->flags & DtWM_HINTS_BEHAVIORS) {
  91. vh.behaviors = pHints->behaviors;
  92. } else {
  93. vh.behaviors = 0L;
  94. }
  95. if (pHints->flags & DtWM_HINTS_ATTACH_WINDOW) {
  96. vh.attachWindow = pHints->attachWindow;
  97. } else {
  98. vh.attachWindow = None;
  99. }
  100. XChangeProperty (
  101. display,
  102. window,
  103. property,
  104. property,
  105. 32,
  106. PropModeReplace,
  107. (unsigned char *)&vh,
  108. (sizeof (DtWmHints)/sizeof (long)));
  109. }