Srv.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. /* $XConsortium: Srv.h /main/6 1996/09/25 08:32:34 barstow $ */
  24. /* *
  25. * (c) Copyright 1993, 1994 Hewlett-Packard Company *
  26. * (c) Copyright 1993, 1994 International Business Machines Corp. *
  27. * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
  28. * (c) Copyright 1993, 1994 Novell, Inc. *
  29. */
  30. /*************************************<+>*************************************
  31. *****************************************************************************
  32. **
  33. ** File: Srv.h
  34. **
  35. ** Project: HP DT Style Manager (part of the session manager)
  36. **
  37. ** Description:
  38. ** -----------
  39. **
  40. **
  41. *******************************************************************
  42. ** (c) Copyright Hewlett-Packard Company, 1990. All rights are
  43. ** reserved. Copying or other reproduction of this program
  44. ** except for archival purposes is prohibited without prior
  45. ** written consent of Hewlett-Packard Company.
  46. ********************************************************************
  47. **
  48. **
  49. **
  50. *****************************************************************************
  51. *************************************<+>*************************************/
  52. /* Standard C headers */
  53. #include <stdio.h>
  54. #ifdef _AIX
  55. #include <sys/types.h>
  56. #include <sys/dir.h>
  57. #else
  58. #include <dirent.h>
  59. #include <limits.h>
  60. #endif /* _AIX */
  61. /* Dt header */
  62. #include <Dt/UserMsg.h>
  63. /* Xm headers */
  64. #include <Xm/ColorObjP.h>
  65. /* #defines */
  66. #define NUM_OF_COLORS 8
  67. #define MAX_NUM_SCREENS 6
  68. /* defines for foreground colors */
  69. #define DYNAMIC 0
  70. #define BLACK 1
  71. #define WHITE 2
  72. #define PALETTE_SUFFIX ".dp"
  73. #define B_O_W "BlackWhite"
  74. #define W_ONLY "White"
  75. #define W_O_B "WhiteBlack"
  76. #define B_ONLY "Black"
  77. /*
  78. * macro to get message catalog strings
  79. */
  80. #ifndef NO_MESSAGE_CATALOG
  81. # define _CLIENT_CAT_NAME "dtsession"
  82. extern char *_DtGetMessage(char *filename, int set, int n, char *s);
  83. # define GETMESSAGE(set, number, string)\
  84. (_DtGetMessage(_CLIENT_CAT_NAME, set, number, string))
  85. #else
  86. # define GETMESSAGE(set, number, string)\
  87. string
  88. #endif
  89. /*******************************************************************************
  90. * Color Palette data structures
  91. *
  92. ******************************************************************************/
  93. /*
  94. ** Define a colorset as foreground, background, topshadow, bottomshadow
  95. ** and selectcolor (also known as arm color).
  96. */
  97. typedef struct _colorset {
  98. XColor fg;
  99. XColor bg;
  100. XColor ts;
  101. XColor bs;
  102. XColor sc;
  103. } ColorSet;
  104. typedef struct _hsv {
  105. int hue;
  106. int saturation;
  107. int value;
  108. } HSVset;
  109. /*
  110. ** Structure which stores the palettes for the customizer
  111. */
  112. typedef struct _palette {
  113. char *name;
  114. char *directory;
  115. int num_of_colors;
  116. ColorSet color[XmCO_MAX_NUM_COLORS];
  117. short defaultActive;
  118. short defaultInactive;
  119. short defaultPrimary;
  120. short defaultSecondary;
  121. short defaultRoot;
  122. char *converted;
  123. unsigned long converted_len;
  124. struct _palette *prev;
  125. struct _palette *next;
  126. } palettes;
  127. /****** Global Variables ********/
  128. typedef struct {
  129. int TypeOfMonitor[MAX_NUM_SCREENS];
  130. int FgColor[MAX_NUM_SCREENS];
  131. Bool UsePixmaps[MAX_NUM_SCREENS];
  132. Bool DynamicColor[MAX_NUM_SCREENS];
  133. int NumOfScreens;
  134. Atom XA_CUSTOMIZE[MAX_NUM_SCREENS];
  135. Atom XA_PIXEL_SET;
  136. Atom XA_PALETTE_NAME;
  137. Atom XA_TYPE_MONITOR;
  138. Atom XA_UPDATE;
  139. struct _palette *pCurrentPalette[MAX_NUM_SCREENS];
  140. } ColorSrv;
  141. extern ColorSrv colorSrv; /* defined in SrvPalette.c */
  142. #define MAX_STR_LEN 128
  143. /*
  144. * Wrappers for system calls
  145. */
  146. #define SRV_MALLOC(SIZE) XtMalloc(SIZE)
  147. #define SRV_REALLOC(PTR, SIZE) XtRealloc(PTR, SIZE)
  148. #define SRV_FREE(PTR) XtFree(PTR)
  149. #define SRV_EXIT(STATUS) exit(status)