WmRequest.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 Hewlett-Packard Company *
  25. * (c) Copyright 1993, 1994 International Business Machines Corp. *
  26. * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
  27. * (c) Copyright 1993, 1994 Novell, Inc. *
  28. */
  29. /************************************<+>*************************************
  30. ****************************************************************************
  31. **
  32. ** File: WmRequest.c
  33. **
  34. ** RCS: $XConsortium: WmRequest.c /main/4 1995/10/26 15:13:08 rswiston $
  35. ** Project: HP DT Workspace Manager
  36. **
  37. ** Description: Send a function request to the window manager
  38. **
  39. ** (c) Copyright 1992, 1993 by Hewlett-Packard Company
  40. **
  41. ****************************************************************************
  42. ************************************<+>*************************************/
  43. #include <stdio.h>
  44. #include <X11/Xlib.h>
  45. #include <X11/Xutil.h>
  46. #include <X11/Xatom.h>
  47. #include <Dt/Wsm.h>
  48. #include <Dt/WsmP.h>
  49. #include <Xm/Xm.h>
  50. #include <Xm/AtomMgr.h>
  51. /*************************************<->*************************************
  52. *
  53. * _DtWmRequestMultiple (display, root, char *pchRequest, int len)
  54. *
  55. *
  56. * Description:
  57. * -----------
  58. * Send one or more function requests to the window manager.
  59. *
  60. *
  61. * Inputs:
  62. * ------
  63. * display - display
  64. * root - root window of screen
  65. * pchRequest - string request (possibly multiple)
  66. * (usu. of form "f.<func> [<arg>]")
  67. * len - length of request, counting terminating NULL
  68. *
  69. * Returns:
  70. * --------
  71. * Success if request sent
  72. *
  73. *************************************<->***********************************/
  74. Status
  75. _DtWmRequestMultiple (
  76. Display *display,
  77. Window root,
  78. char *pchRequest,
  79. int len)
  80. {
  81. Status rval = BadAtom;
  82. Window wmWindow;
  83. /*
  84. * Get the workspace manager window
  85. */
  86. if ((rval=_DtGetMwmWindow (display, root, &wmWindow)) == Success)
  87. {
  88. /*
  89. * Make the request by appending the request
  90. * to the _DT_WM_REQUEST property
  91. */
  92. rval = XChangeProperty (display, wmWindow,
  93. XmInternAtom(display, _XA_DT_WM_REQUEST, False),
  94. XA_STRING, 8, PropModeAppend,
  95. (unsigned char *)pchRequest,
  96. len);
  97. }
  98. return (rval);
  99. } /* END OF FUNCTION _DtWmRequestMultiple */
  100. #if 0
  101. /*************************************<->*************************************
  102. *
  103. * DtWmRequest (display, root, char *pchRequest)
  104. *
  105. *
  106. * Description:
  107. * -----------
  108. * Send a function request to the window manager.
  109. *
  110. *
  111. * Inputs:
  112. * ------
  113. * display - display
  114. * root - root window of screen
  115. * pchRequest - NULL terminated string request
  116. * (usu. of form "f.<func> [<arg>]")
  117. *
  118. * Returns:
  119. * --------
  120. * Success if request sent
  121. *
  122. *************************************<->***********************************/
  123. Status
  124. DtWmRequest (Display *display, Window root, char *pchRequest)
  125. {
  126. return (_DtWmRequestMultiple (display, root,
  127. pchRequest, 1+strlen(pchRequest)));
  128. } /* END OF FUNCTION DtWmRequest */
  129. #endif