Codebase list libdockapp / b3be451
libdockapp: Remove trailing whitespace. Doug Torrance authored 9 years ago Carlos R. Mafra committed 9 years ago
13 changed file(s) with 49 addition(s) and 49 deletion(s). Raw diff Collapse all Expand all
00 # $Id: Imakefile,v 1.4 2002/10/16 07:19:18 dalroi Exp $
11
22 STD_INCLUDES = $(INC_PATH) -I/usr/local/include -I.
3 DEPLIBS = $(DEPXLIB)
3 DEPLIBS = $(DEPXLIB)
44
55 LOCAL_LIBRARIES = $(LIB_PATH) -L/usr/local/lib -L/usr/X11R6/lib \
66 -L../../src/.libs \
1111 These icons were originally made for Mosaic for X and have been
1212 included in the NCSA httpd and Apache server distributions in the
1313 past. They are in the public domain and may be freely included in any
14 application. The originals were done by Kevin Hughes
14 application. The originals were done by Kevin Hughes
1515 (kevinh@kevcom.com).
1616
1717 Many thanks to Andy Polyakov for tuning the icon colors and adding a
00 /* $Id: basic.c,v 1.10 2003/02/10 12:35:03 dalroi Exp $
11 *
22 * Copyright (c) 2002 Alban G. Hertroys
3 *
3 *
44 * Basic example of libDockapp usage
55 *
66 * This dockapp will draw a rectangle with a
178178 x = 1;
179179 dx = -dx + var;
180180 }
181
181
182182 if (y < 1) {
183183 y = 1;
184184 dy = -dy + var;
188188 x = 46 - ballPix->geometry.width;
189189 dx = -dx + var;
190190 }
191
191
192192 if (y + ballPix->geometry.height > 46) {
193193 y = 46 - ballPix->geometry.height;
194194 dy = -dy + var;
00 # $Id: Imakefile,v 1.1 2002/10/16 07:19:18 dalroi Exp $
11
22 STD_INCLUDES = $(INC_PATH) -I/usr/local/include -I.
3 DEPLIBS = $(DEPXLIB)
3 DEPLIBS = $(DEPXLIB)
44
55 LOCAL_LIBRARIES = $(LIB_PATH) -L/usr/local/lib -L/usr/X11R6/lib \
66 -L../../src/.libs \
3232 GC black; /* background color, idem */
3333 GC lightGray; /* Some GC's we'll have to define for colors */
3434 GC darkGray;
35 GC slider; /* draw-color when not highlighted,
35 GC slider; /* draw-color when not highlighted,
3636 * dark-color when highlighted
3737 */
3838 GC sliderLight; /* draw-color when highlighted */
124124 /* define what to do if an event occurs in a rectangle */
125125 DAActionRect *buttonPressRects, *buttonReleaseRects,
126126 *mouseMoveRects, *mouseEnterRects, *mouseLeaveRects;
127
127
128128 buttonPressRects = malloc(3 * sizeof(DAActionRect));
129129 buttonPressRects[0] = setRectAction(btn, btnDown);
130130 buttonPressRects[1] = setRectAction(square, squareDown);
143143 mouseLeaveRects = malloc(2 * sizeof(DAActionRect));
144144 mouseLeaveRects[0] = setRectAction(btn, btnLeave);
145145 mouseLeaveRects[1] = setRectAction(slider, sliderLeave);
146
146
147147
148148 /* XXX: make action rectangles available outside main()
149149 * ...libDockapp should be able to do this... (reminder)
207207 */
208208 pointer = XCreateFontCursor(DADisplay, XC_based_arrow_up);
209209 XDefineCursor(DADisplay, DAWindow, pointer);
210
210
211211 /* a square with an image that changes when clicked (A button). */
212212 createBtn(btn);
213213
257257
258258 /* don't send expose events */
259259 gcv.graphics_exposures = False;
260
260
261261 /* GC for white color */
262262 gcv.foreground = WhitePixel(DADisplay, DefaultScreen(DADisplay));
263263 colors->white = XCreateGC(DADisplay, d,
271271 #endif
272272 colors->black = XCreateGC(DADisplay, d,
273273 GCForeground|GCGraphicsExposures, &gcv);
274
274
275275 /* GC for light borders */
276276 gcv.foreground = DAGetColor("lightGray");
277277 colors->lightGray = XCreateGC(DADisplay, d,
328328 r += adjustment;
329329 g += adjustment;
330330 b += adjustment;
331
331
332332 if (r > 0xff) r = 0xff;
333333 if (g > 0xff) g = 0xff;
334334 if (b > 0xff) b = 0xff;
336336 if (r < 0) r = 0;
337337 if (g < 0) g = 0;
338338 if (b < 0) b = 0;
339
339
340340 return ((unsigned short)r << 16) +
341341 ((unsigned short)g << 8) +
342342 (unsigned short)b;
448448
449449 if (data) {
450450 int *tmp = (int*)data;
451
451
452452 button = *tmp;
453453 } else
454454 button = 0;
489489 sliderPos = (float)(rect.height - y)/(float)rect.height;
490490 if (sliderPos > 1.0) sliderPos = 1.0;
491491 if (sliderPos < 0.0) sliderPos = 0.0;
492
492
493493 drawSlider(rect);
494494 }
495495
555555 DASetPixmap(pixmap);
556556 }
557557
558
558
559559 void
560560 createSquare(DARect rect)
561561 {
00 fontdir = @FONTDIR@
11 dist_font_DATA = luxel-ascii-06x09.pcf.gz \
2 seg7-ascii-05x07.pcf.gz
2 seg7-ascii-05x07.pcf.gz
33
44 install-data-hook:
55 @rm -f $(DESTDIR)$(fontdir)/font.dir
2929 DASetCallbacks(DACallbacks *callbacks)
3030 {
3131 long mask = 0;
32
32
3333 _daContext->callbacks = *callbacks;
3434
3535 if (callbacks->destroy)
4444 mask |= EnterWindowMask;
4545 if (callbacks->leave)
4646 mask |= LeaveWindowMask;
47
47
4848 XSelectInput(DADisplay, DAWindow, mask);
4949 XFlush(DADisplay);
5050 }
3030 DAGetColor(char *colorName)
3131 {
3232 XColor color;
33
33
3434 if (!XParseColor(DADisplay,
3535 DefaultColormap(DADisplay, DefaultScreen(DADisplay)),
3636 colorName, &color))
3737 DAError("could not parse color %s", colorName);
38
38
3939 if (!XAllocColor(DADisplay, DefaultColormap(DADisplay, DefaultScreen(DADisplay)), &color)) {
4040 DAWarning("could not allocate color %s. Using black instead", colorName);
4141 return BlackPixel(DADisplay, DefaultScreen(DADisplay));
4242 }
43
43
4444 return color.pixel;
4545 }
4646
101101 default:
102102 return False;
103103 }
104
104
105105 return True;
106106 }
107107
136136 {
137137 struct timeval timeout;
138138 fd_set rset;
139
139
140140 XSync(DADisplay, False);
141141 if (XPending(DADisplay)) {
142142 XNextEvent(DADisplay, event);
143143 return True;
144144 }
145
145
146146 timeout.tv_sec = milliseconds / 1000;
147147 timeout.tv_usec = (milliseconds % 1000) * 1000;
148
148
149149 FD_ZERO(&rset);
150150 FD_SET(ConnectionNumber(DADisplay), &rset);
151
151
152152 if (select(ConnectionNumber(DADisplay)+1, &rset, NULL, NULL, &timeout) > 0) {
153153 XNextEvent(DADisplay, event);
154154 return True;
155155 }
156
156
157157 return False;
158158 }
159159
6969
7070 /* Get the nearest allowed icon size if the WM specifies such */
7171 iconSizes = XAllocIconSize();
72 if (XGetIconSizes(DADisplay, DefaultRootWindow(DADisplay),
72 if (XGetIconSizes(DADisplay, DefaultRootWindow(DADisplay),
7373 &iconSizes, &nrSizes)) {
7474 int i;
7575 int da = -1;
7979 for (i = 0; i < nrSizes; i++) {
8080 int w1, h1, w, h;
8181
82 if ((max_w < iconSizes[i].max_width) ||
82 if ((max_w < iconSizes[i].max_width) ||
8383 (max_h < iconSizes[i].max_height)) {
8484 max_w = iconSizes[i].max_width;
8585 max_h = iconSizes[i].max_height;
8686 }
87
88 if ((min_w > iconSizes[i].min_width) ||
89 (min_h > iconSizes[i].min_height) ||
87
88 if ((min_w > iconSizes[i].min_width) ||
89 (min_h > iconSizes[i].min_height) ||
9090 (min_w == -1)) {
9191 min_w = iconSizes[i].min_width;
9292 min_h = iconSizes[i].min_height;
9393 }
94
94
9595 if ((width > iconSizes[i].max_width) ||
9696 (width < iconSizes[i].min_width) ||
9797 (height > iconSizes[i].max_height) ||
9898 (height < iconSizes[i].min_height))
9999 continue;
100
100
101101 w1 = (iconSizes[i].max_width - width ) % iconSizes[i].width_inc;
102102 h1 = (iconSizes[i].max_height - height) % iconSizes[i].height_inc;
103103 w = MIN(w1, iconSizes[i].width_inc - w1);
180180 /* Set WMProtocols */
181181 WM_DELETE_WINDOW = XInternAtom(DADisplay, "WM_DELETE_WINDOW", True);
182182 XSetWMProtocols(DADisplay, DALeader, &WM_DELETE_WINDOW, 1);
183
183
184184 /* Set Command to start the app so it can be docked properly */
185185 XSetCommand(DADisplay, DALeader, argv, argc);
186186
117117 unsigned short *width, unsigned short *height)
118118 {
119119 XpmAttributes xpmAttr;
120
120
121121 xpmAttr.valuemask = XpmCloseness;
122122 xpmAttr.closeness = 40000;
123
124
123
124
125125 if (source == daXpmSourceData
126126 && (XpmCreatePixmapFromData(
127127 DADisplay, DAWindow, data, pixmap, mask, &xpmAttr) != 0))
134134
135135 *width = xpmAttr.width;
136136 *height = xpmAttr.height;
137
137
138138 return True;
139139 }
140140
1616 * AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1717 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1818 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 *
19 *
2020 * $Id: dashaped.c,v 1.11 2008/05/01 09:49:06 dalroi Exp $
2121 */
2222
5656 dasp->shape = DAMakeShape();
5757 dasp->geometry.width = _daContext->width;
5858 dasp->geometry.height = _daContext->height;
59
59
6060 setGCs(dasp);
6161 DASPClear(dasp);
6262
176176
177177 if (dasp == NULL)
178178 return NULL;
179
179
180180 memset(dasp, 0, sizeof(DAShapedPixmap));
181181
182182 if (source == daShapeSourceData)
188188
189189 if (!success)
190190 return NULL;
191
191
192192 setGCs(dasp);
193193
194194 return dasp;
1616 * AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1717 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1818 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 *
19 *
2020 * $Id: dockapp.h,v 1.18 2005/07/16 11:49:10 dalroi Exp $
2121 */
2222
4848
4949 /* !!! DEPRECATED !!!
5050 * This feature may be removed in the future. Use DAEventCallbacks instead.
51 *
51 *
5252 * the callbacks for events related to the dockapp window your program wants
5353 * to handle
5454 */
7474 char *shortForm; /* short form for option, like -w */
7575 char *longForm; /* long form for option, like --withdrawn */
7676 char *description; /* description for the option */
77
77
7878 short type; /* type of argument */
7979 Bool used; /* if the argument was passed on the cmd-line */
80
80
8181 /* the following are only set if the "used" field is True */
8282 union {
8383 void *ptr; /* a ptr for the value that was passed */