annotate lcdemu/window.c @ 6:0775b86c4a28

README added
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Mar 2018 03:50:38 +0000
parents e7f1035f10d4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * LCDemu based on HECterm by the same author
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * X11 window creation functions
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdlib.h>
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <string.h>
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <strings.h>
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <X11/Xlib.h>
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <X11/Xresource.h>
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <X11/Xutil.h>
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "globals.h"
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 extern char *xrm_lookup();
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 create_our_window()
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 XrmQuark instquarks[3], classquarks[3];
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 register char *cp;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 register int i, geomask;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 int pixwidth, pixheight, xpos, ypos;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 XSetWindowAttributes xswa;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 u_long xswamask;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 XColor bdcolor;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 XClassHint xclasshint;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 XWMHints wmhints;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 XSizeHints wm_normal_hints;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 /* Determine our geometry */
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 instquarks[0] = xrmquark_topinstance;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 classquarks[0] = xrmquark_topclass;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 classquarks[1] = instquarks[1] = XrmStringToQuark("geometry");
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 instquarks[2] = classquarks[2] = NULLQUARK;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 cp = xrm_lookup(instquarks, classquarks);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 if (cp) {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 geomask = XParseGeometry(cp, &xpos, &ypos, &pixwidth,
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 &pixheight);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 free(cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 } else
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 geomask = 0;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 if (!(geomask & WidthValue))
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 pixwidth = 176;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 if (!(geomask & HeightValue))
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 pixheight = 220;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 if (!(geomask & XValue))
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 xpos = 0;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 else if (geomask & XNegative)
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 xpos += DisplayWidth(mydisplay, DefaultScreen(mydisplay)) -
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 pixwidth;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 if (!(geomask & YValue))
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 ypos = 0;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 else if (geomask & YNegative)
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 ypos += DisplayHeight(mydisplay, DefaultScreen(mydisplay)) -
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 pixheight;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 /* fill out XSetWindowAttributes */
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 xswa.event_mask = 0; /* not interested in any events */
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 xswamask = CWEventMask;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 /* border color */
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 classquarks[1] = instquarks[1] = XrmStringToQuark("borderColor");
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 cp = xrm_lookup(instquarks, classquarks);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 if (cp) {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 i = XParseColor(mydisplay, DefaultColormap(mydisplay,
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 DefaultScreen(mydisplay)), cp, &bdcolor);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 free(cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 if (i) {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 i = XAllocColor(mydisplay, DefaultColormap(mydisplay,
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 DefaultScreen(mydisplay)), &bdcolor);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 if (i) {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 xswa.border_pixel = bdcolor.pixel;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 xswamask |= CWBorderPixel;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 }
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 }
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 }
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 /* border width */
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 classquarks[1] = instquarks[1] = XrmStringToQuark("borderWidth");
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 cp = xrm_lookup(instquarks, classquarks);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 if (cp) {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 i = atoi(cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 free(cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 } else
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 i = 2;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 /* go for it! */
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 mainwindow = XCreateWindow(mydisplay, DefaultRootWindow(mydisplay),
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 xpos, ypos, pixwidth, pixheight, i, CopyFromParent,
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 InputOutput, CopyFromParent, xswamask, &xswa);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 /* set window manager properties */
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 xclasshint.res_name = proginstancename;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 xclasshint.res_class = "LEDemu";
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 XSetClassHint(mydisplay, mainwindow, &xclasshint);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 wmhints.flags = InputHint | StateHint;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 wmhints.input = False;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 classquarks[1] = instquarks[1] = XrmStringToQuark("iconic");
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 cp = xrm_lookup(instquarks, classquarks);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 if (cp) {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 i = parse_boolean_resource(cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 free(cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 } else
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 i = 0;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 wmhints.initial_state = i ? IconicState : NormalState;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 XSetWMHints(mydisplay, mainwindow, &wmhints);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 if (geomask & (WidthValue|HeightValue))
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 wm_normal_hints.flags = USSize;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 else
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 wm_normal_hints.flags = PSize;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 if (geomask & (XValue|YValue))
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 wm_normal_hints.flags |= USPosition;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 XSetWMNormalHints(mydisplay, mainwindow, &wm_normal_hints);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 }
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 set_initial_window_title()
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 XrmQuark instquarks[3], classquarks[3];
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 register char *cp;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 char buf[256];
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 instquarks[0] = xrmquark_topinstance;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 classquarks[0] = xrmquark_topclass;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 instquarks[1] = XrmStringToQuark("title");
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 classquarks[1] = XrmStringToQuark("Title");
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 instquarks[2] = classquarks[2] = NULLQUARK;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 cp = xrm_lookup(instquarks, classquarks);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 if (cp) {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 XStoreName(mydisplay, mainwindow, cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 free(cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 return;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 }
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 XStoreName(mydisplay, mainwindow, "Emulated LCD");
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 }
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 set_initial_icon_name()
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 XrmQuark instquarks[3], classquarks[3];
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 register char *cp;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 instquarks[0] = xrmquark_topinstance;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 classquarks[0] = xrmquark_topclass;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 instquarks[1] = XrmStringToQuark("iconName");
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 classquarks[1] = XrmStringToQuark("IconName");
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 instquarks[2] = classquarks[2] = NULLQUARK;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 cp = xrm_lookup(instquarks, classquarks);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 if (cp) {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 XSetIconName(mydisplay, mainwindow, cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 free(cp);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 return;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 }
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 XSetIconName(mydisplay, mainwindow, proginstancename);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 }
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 create_mainwin_gc()
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 {
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 XGCValues xgcval;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 xgcval.graphics_exposures = False;
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 mainwingc = XCreateGC(mydisplay, mainwindow, GCGraphicsExposures,
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 &xgcval);
e7f1035f10d4 lcdemu: initial import from freecalypso-tools
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 }