wmusic: Remove libdockapp directory; we will used shared lib.
This commit is contained in:
parent
08e87d5780
commit
12843a05f5
|
@ -1,3 +0,0 @@
|
||||||
Alfredo K. Kojima <kojima@windowmaker.org>
|
|
||||||
Pascal G. Hofstee <daeron@windowmaker.org>
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
Copyright (c) 1999 Alfredo K. Kojima
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
DockApp Making Standard Library
|
|
||||||
|
|
||||||
Alfredo K. Kojima <kojima@windowmaker.org>
|
|
||||||
Pascal G. Hofstee <daeron@windowmaker.org>
|
|
||||||
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
You must have the libXpm library installed and the shape extension supported
|
|
||||||
by your X server to be able to build and install libdockapp.
|
|
||||||
|
|
||||||
To compile libDockApp enter the libdockapp directory and type:
|
|
||||||
|
|
||||||
./configure
|
|
||||||
make install
|
|
||||||
|
|
||||||
|
|
||||||
The API is described in dockapp.h wmtest.c is a sample program
|
|
||||||
that shows the library usage.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
License:
|
|
||||||
|
|
||||||
Copyright (c) 1999, 2000 Alfredo K. Kojima, Pascal Hofstee
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
3. The name of the author may not be used to endorse or promote products
|
|
||||||
derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999 Alfredo K. Kojima
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
* $Id: dacallback.c,v 1.1.1.1 2004/02/27 02:53:10 john Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dockapp.h"
|
|
||||||
|
|
||||||
extern DACallbacks d_callbacks;
|
|
||||||
extern int d_timeout;
|
|
||||||
|
|
||||||
void
|
|
||||||
DASetCallbacks(DACallbacks *callbacks)
|
|
||||||
{
|
|
||||||
long mask = 0;
|
|
||||||
|
|
||||||
d_callbacks = *callbacks;
|
|
||||||
|
|
||||||
if (callbacks->buttonPress)
|
|
||||||
mask |= ButtonPressMask;
|
|
||||||
if (callbacks->buttonRelease)
|
|
||||||
mask |= ButtonReleaseMask;
|
|
||||||
if (callbacks->motion)
|
|
||||||
mask |= PointerMotionMask;
|
|
||||||
|
|
||||||
XSelectInput(DADisplay, DAWindow, mask);
|
|
||||||
XFlush(DADisplay);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
DASetTimeout(int miliseconds)
|
|
||||||
{
|
|
||||||
d_timeout = miliseconds;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999 Alfredo K. Kojima
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
* $Id: dacolor.c,v 1.1.1.1 2004/02/27 02:53:10 john Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dockapp.h"
|
|
||||||
|
|
||||||
extern char *progName;
|
|
||||||
|
|
||||||
unsigned long
|
|
||||||
DAGetColor(char *colorName)
|
|
||||||
{
|
|
||||||
XColor color;
|
|
||||||
|
|
||||||
if (!XParseColor(DADisplay,
|
|
||||||
DefaultColormap(DADisplay, DefaultScreen(DADisplay)),
|
|
||||||
colorName, &color))
|
|
||||||
printf("%s: could not parse color %s\n", progName, colorName), exit(1);
|
|
||||||
|
|
||||||
if (!XAllocColor(DADisplay, DefaultColormap(DADisplay, DefaultScreen(DADisplay)), &color)) {
|
|
||||||
printf("%s: could not allocate color %s. Using black\n", progName, colorName);
|
|
||||||
return BlackPixel(DADisplay, DefaultScreen(DADisplay));
|
|
||||||
}
|
|
||||||
|
|
||||||
return color.pixel;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,122 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999 Alfredo K. Kojima
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
* $Id: daevent.c,v 1.1.1.1 2004/02/27 02:53:10 john Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include "dockapp.h"
|
|
||||||
|
|
||||||
extern Window DALeader;
|
|
||||||
extern DACallbacks d_callbacks;
|
|
||||||
extern int d_timeout;
|
|
||||||
|
|
||||||
Bool
|
|
||||||
DAProcessEvent(XEvent *event)
|
|
||||||
{
|
|
||||||
if ((event->xany.window != DAWindow) && (event->xany.window != DALeader))
|
|
||||||
return False;
|
|
||||||
|
|
||||||
switch (event->type) {
|
|
||||||
case DestroyNotify:
|
|
||||||
if (d_callbacks.destroy)
|
|
||||||
(*d_callbacks.destroy)();
|
|
||||||
exit(0);
|
|
||||||
break;
|
|
||||||
case ButtonPress:
|
|
||||||
if (d_callbacks.buttonPress)
|
|
||||||
(*d_callbacks.buttonPress)(event->xbutton.button,
|
|
||||||
event->xbutton.state,
|
|
||||||
event->xbutton.x,
|
|
||||||
event->xbutton.y);
|
|
||||||
break;
|
|
||||||
case ButtonRelease:
|
|
||||||
if (d_callbacks.buttonRelease)
|
|
||||||
(*d_callbacks.buttonRelease)(event->xbutton.button,
|
|
||||||
event->xbutton.state,
|
|
||||||
event->xbutton.x,
|
|
||||||
event->xbutton.y);
|
|
||||||
break;
|
|
||||||
case MotionNotify:
|
|
||||||
if (d_callbacks.motion)
|
|
||||||
(*d_callbacks.motion)(event->xmotion.x,
|
|
||||||
event->xmotion.y);
|
|
||||||
break;
|
|
||||||
case EnterNotify:
|
|
||||||
if (d_callbacks.enter)
|
|
||||||
(*d_callbacks.enter)();
|
|
||||||
break;
|
|
||||||
case LeaveNotify:
|
|
||||||
if (d_callbacks.leave)
|
|
||||||
(*d_callbacks.leave)();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
DAEventLoop(void)
|
|
||||||
{
|
|
||||||
XEvent event;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
if (d_timeout >= 0) {
|
|
||||||
if (!DANextEventOrTimeout(&event, d_timeout)) {
|
|
||||||
if (d_callbacks.timeout)
|
|
||||||
(*d_callbacks.timeout)();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
XNextEvent(DADisplay, &event);
|
|
||||||
|
|
||||||
DAProcessEvent(&event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
DANextEventOrTimeout(XEvent *event, unsigned long miliseconds)
|
|
||||||
{
|
|
||||||
struct timeval timeout;
|
|
||||||
fd_set rset;
|
|
||||||
|
|
||||||
XSync(DADisplay, False);
|
|
||||||
if (XPending(DADisplay)) {
|
|
||||||
XNextEvent(DADisplay, event);
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
||||||
timeout.tv_sec = miliseconds / 1000;
|
|
||||||
timeout.tv_usec = (miliseconds % 1000) * 1000;
|
|
||||||
|
|
||||||
FD_ZERO(&rset);
|
|
||||||
FD_SET(ConnectionNumber(DADisplay), &rset);
|
|
||||||
|
|
||||||
if (select(ConnectionNumber(DADisplay)+1, &rset, NULL, NULL, &timeout) > 0) {
|
|
||||||
XNextEvent(DADisplay, event);
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,335 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999 Alfredo K. Kojima
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
* $Id: damain.c,v 1.1.1.1 2004/02/27 02:53:10 john Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dockapp.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define MIN(a, b) (a < b ? a : b)
|
|
||||||
|
|
||||||
|
|
||||||
char *progName = NULL;
|
|
||||||
int d_width, d_height;
|
|
||||||
int d_windowed = 0;
|
|
||||||
int d_timeout = 0;
|
|
||||||
DACallbacks d_callbacks = {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
|
||||||
|
|
||||||
DARect DANoRect = {0, 0, 0, 0};
|
|
||||||
Display *DADisplay = NULL;
|
|
||||||
Window DALeader = None;
|
|
||||||
Window DAWindow = None;
|
|
||||||
int DADepth = 0;
|
|
||||||
Visual *DAVisual = NULL;
|
|
||||||
GC DAGC = NULL;
|
|
||||||
DARect DAPreferredIconSizes = {-1, -1, 0, 0};
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
DAGetDisplay(char *display, int argc, char **argv)
|
|
||||||
{
|
|
||||||
progName = argv[0];
|
|
||||||
|
|
||||||
/* Open Connection to X Server */
|
|
||||||
DADisplay = XOpenDisplay(display);
|
|
||||||
if (!DADisplay) {
|
|
||||||
printf("%s: could not open display %s!\n", progName,
|
|
||||||
XDisplayName(display));
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
DAProposeIconSize(unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
XIconSize *iconSizes;
|
|
||||||
int nrSizes = 0;
|
|
||||||
|
|
||||||
d_width = width;
|
|
||||||
d_height = height;
|
|
||||||
|
|
||||||
/* Get the nearest allowed icon size if the WM specifies such */
|
|
||||||
iconSizes = XAllocIconSize();
|
|
||||||
if (XGetIconSizes(DADisplay, DefaultRootWindow(DADisplay),
|
|
||||||
&iconSizes, &nrSizes)) {
|
|
||||||
int i;
|
|
||||||
int da = -1;
|
|
||||||
int min_w = -1, min_h = -1;
|
|
||||||
int max_w = 0, max_h = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < nrSizes; i++) {
|
|
||||||
int w1, h1, w, h;
|
|
||||||
|
|
||||||
if ((max_w < iconSizes[i].max_width) ||
|
|
||||||
(max_h < iconSizes[i].max_height)) {
|
|
||||||
max_w = iconSizes[i].max_width;
|
|
||||||
max_h = iconSizes[i].max_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((min_w > iconSizes[i].min_width) ||
|
|
||||||
(min_h > iconSizes[i].min_height) ||
|
|
||||||
(min_w == -1)) {
|
|
||||||
min_w = iconSizes[i].min_width;
|
|
||||||
min_h = iconSizes[i].min_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((width > iconSizes[i].max_width) ||
|
|
||||||
(width < iconSizes[i].min_width) ||
|
|
||||||
(height > iconSizes[i].max_height) ||
|
|
||||||
(height < iconSizes[i].min_height))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
w1 = (iconSizes[i].max_width - width ) % iconSizes[i].width_inc;
|
|
||||||
h1 = (iconSizes[i].max_height - height) % iconSizes[i].height_inc;
|
|
||||||
w = MIN(w1, iconSizes[i].width_inc - w1);
|
|
||||||
h = MIN(h1, iconSizes[i].height_inc - h1);
|
|
||||||
|
|
||||||
if ((w * h < da) || (da == -1)) {
|
|
||||||
d_width = width + w;
|
|
||||||
d_height = height + h;
|
|
||||||
da = w * h;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DAPreferredIconSizes.x = min_w;
|
|
||||||
DAPreferredIconSizes.y = min_h;
|
|
||||||
DAPreferredIconSizes.width = max_w;
|
|
||||||
DAPreferredIconSizes.height = max_h;
|
|
||||||
|
|
||||||
if (da == -1) { /* requested size is out of bounds */
|
|
||||||
printf("Warning (%s): requested icon-size (%d x %d) is out of the range "
|
|
||||||
"allowed by the window manager\n",
|
|
||||||
progName, d_width, d_height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
XFree(iconSizes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
DACreateIcon(char *name, unsigned width, unsigned height, int argc, char **argv)
|
|
||||||
{
|
|
||||||
XClassHint *classHint;
|
|
||||||
XWMHints *wmHints;
|
|
||||||
XGCValues gcv;
|
|
||||||
|
|
||||||
|
|
||||||
d_width = width;
|
|
||||||
d_height = height;
|
|
||||||
|
|
||||||
/* Create Windows */
|
|
||||||
DAWindow = XCreateSimpleWindow(DADisplay, DefaultRootWindow(DADisplay),
|
|
||||||
0, 0, width, height, 0, 0, 0);
|
|
||||||
DALeader = XCreateSimpleWindow(DADisplay, DefaultRootWindow(DADisplay),
|
|
||||||
0, 0, 1, 1, 0, 0, 0);
|
|
||||||
|
|
||||||
/* Set ClassHint */
|
|
||||||
if (!(classHint = XAllocClassHint()))
|
|
||||||
printf("%s: can't allocate memory for class hints!\n", progName), exit(1);
|
|
||||||
classHint->res_class = "DockApp";
|
|
||||||
classHint->res_name = name;
|
|
||||||
|
|
||||||
XSetClassHint(DADisplay, DALeader, classHint);
|
|
||||||
XFree(classHint);
|
|
||||||
|
|
||||||
/* Set WMHints */
|
|
||||||
if (!(wmHints = XAllocWMHints()))
|
|
||||||
printf("%s: can't allocate memory for wm hints!\n", progName), exit(1);
|
|
||||||
|
|
||||||
wmHints->flags = IconWindowHint|WindowGroupHint;
|
|
||||||
|
|
||||||
if (!d_windowed) {
|
|
||||||
wmHints->flags |= StateHint;
|
|
||||||
wmHints->initial_state = WithdrawnState;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Hadess
|
|
||||||
{
|
|
||||||
Status status;
|
|
||||||
XTextProperty title;
|
|
||||||
|
|
||||||
status = XStringListToTextProperty(&progName, 1, &title);
|
|
||||||
XSetWMName(DADisplay, DALeader, &title);
|
|
||||||
XSetWMName(DADisplay, DAWindow, &title);
|
|
||||||
// XStoreName(DADisplay, DALeader, progName);
|
|
||||||
// XStoreName(DADisplay, DAWindow, progName);
|
|
||||||
}
|
|
||||||
wmHints->window_group = DALeader;
|
|
||||||
wmHints->icon_window = DAWindow;
|
|
||||||
|
|
||||||
XSetWMHints(DADisplay, DALeader, wmHints);
|
|
||||||
|
|
||||||
/* Set Command to start the app so it can be docked properly */
|
|
||||||
XSetCommand(DADisplay, DALeader, argv, argc);
|
|
||||||
|
|
||||||
DADepth = DefaultDepth(DADisplay, DefaultScreen(DADisplay));
|
|
||||||
DAVisual = DefaultVisual(DADisplay, DefaultScreen(DADisplay));
|
|
||||||
DAGC = DefaultGC(DADisplay, DefaultScreen(DADisplay));
|
|
||||||
gcv.graphics_exposures = False;
|
|
||||||
XChangeGC(DADisplay, DAGC, GCGraphicsExposures, &gcv);
|
|
||||||
|
|
||||||
XFlush(DADisplay);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
DAShow(void)
|
|
||||||
{
|
|
||||||
if (!d_windowed)
|
|
||||||
XMapRaised(DADisplay, DALeader);
|
|
||||||
else
|
|
||||||
XMapRaised(DADisplay, DAWindow);
|
|
||||||
|
|
||||||
XFlush(DADisplay);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static DAProgramOption defaultOptions[] = {
|
|
||||||
{"-h", "--help", "shows this help text and exit", DONone, False, {NULL}},
|
|
||||||
{"-v", "--version", "shows program version and exit", DONone, False, {NULL}},
|
|
||||||
{"-w", "--windowed", "runs the application in windowed mode", DONone, False, {NULL}}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
printHelp(char *prog, char *description, DAProgramOption *options, int count)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
|
|
||||||
printf("Usage: %s [OPTIONS]\n", prog);
|
|
||||||
if (description)
|
|
||||||
puts(description);
|
|
||||||
|
|
||||||
for (j = 0; j < count + 3; j++) {
|
|
||||||
char blank[30];
|
|
||||||
int c;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (j >= count) {
|
|
||||||
options = defaultOptions;
|
|
||||||
i = j - count;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
i = j;
|
|
||||||
|
|
||||||
if (options[i].shortForm && options[i].longForm)
|
|
||||||
c = printf(" %s, %s", options[i].shortForm, options[i].longForm);
|
|
||||||
else if (options[i].shortForm)
|
|
||||||
c = printf(" %s", options[i].shortForm);
|
|
||||||
else if (options[i].longForm)
|
|
||||||
c = printf(" %s", options[i].longForm);
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (options[i].type != DONone) {
|
|
||||||
switch (options[i].type) {
|
|
||||||
case DOInteger:
|
|
||||||
c += printf(" <integer>");
|
|
||||||
break;
|
|
||||||
case DOString:
|
|
||||||
c += printf(" <string>");
|
|
||||||
break;
|
|
||||||
case DONatural:
|
|
||||||
c += printf(" <number>");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(blank, ' ', 30);
|
|
||||||
if (c > 29)
|
|
||||||
c = 1;
|
|
||||||
blank[30-c] = 0;
|
|
||||||
printf("%s %s\n", blank, options[i].description);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
DAParseArguments(int argc, char **argv, DAProgramOption *options,
|
|
||||||
int count, char *programDescription, char *versionDescription)
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
int found = 0;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
|
||||||
if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
|
|
||||||
printHelp(argv[0], programDescription, options, count), exit(0);
|
|
||||||
if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
|
|
||||||
puts(versionDescription), exit(0);
|
|
||||||
if (strcmp(argv[i], "-w") == 0 || strcmp(argv[i], "--windowed") == 0) {
|
|
||||||
d_windowed = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
found = 0;
|
|
||||||
for (j = 0; j < count; j++) {
|
|
||||||
if ((options[j].shortForm && strcmp(options[j].shortForm, argv[i]) == 0) ||
|
|
||||||
(options[j].longForm && strcmp(options[j].longForm, argv[i]) == 0)) {
|
|
||||||
found = 1;
|
|
||||||
|
|
||||||
options[j].used = True;
|
|
||||||
|
|
||||||
if (options[j].type == DONone)
|
|
||||||
break;
|
|
||||||
|
|
||||||
i++;
|
|
||||||
if (i >= argc)
|
|
||||||
printf("%s: missing argument for option '%s'\n", argv[0], argv[i-1]), exit(1);
|
|
||||||
|
|
||||||
switch (options[j].type) {
|
|
||||||
case DOInteger:
|
|
||||||
{
|
|
||||||
int integer;
|
|
||||||
|
|
||||||
if (sscanf(argv[i], "%i", &integer) != 1)
|
|
||||||
printf("%s: error parsing argument for option %s\n",
|
|
||||||
argv[0], argv[i-1]), exit(1);
|
|
||||||
*options[j].value.integer = integer;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DONatural:
|
|
||||||
{
|
|
||||||
int integer;
|
|
||||||
|
|
||||||
if (sscanf(argv[i], "%i", &integer) != 1)
|
|
||||||
printf("%s: error oarsing argument for option %s\n",
|
|
||||||
argv[0], argv[i-1]), exit(1);
|
|
||||||
if (integer < 0)
|
|
||||||
printf("%s: argument %s must be >= 0\n",
|
|
||||||
argv[0], argv[i-1]), exit(1);
|
|
||||||
*options[j].value.integer = integer;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DOString:
|
|
||||||
*options[j].value.string = argv[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
printf("%s: unrecognized option '%s'\n", argv[0], argv[i]);
|
|
||||||
printHelp(argv[0], programDescription, options, count), exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999 Alfredo K. Kojima
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
* $Id: dapixmap.c,v 1.1.1.1 2004/02/27 02:53:10 john Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/xpm.h>
|
|
||||||
#include <X11/extensions/shape.h>
|
|
||||||
#include <X11/Xatom.h>
|
|
||||||
#include "dockapp.h"
|
|
||||||
|
|
||||||
extern int d_width, d_height;
|
|
||||||
|
|
||||||
void
|
|
||||||
DASetShapeWithOffset(Pixmap shapeMask, int x_ofs, int y_ofs)
|
|
||||||
{
|
|
||||||
XShapeCombineMask(DADisplay, DAWindow, ShapeBounding, -x_ofs, -y_ofs, shapeMask,
|
|
||||||
ShapeSet);
|
|
||||||
XFlush(DADisplay);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
DASetPixmap(Pixmap pixmap)
|
|
||||||
{
|
|
||||||
XSetWindowBackgroundPixmap(DADisplay, DAWindow, pixmap);
|
|
||||||
XClearWindow(DADisplay, DAWindow);
|
|
||||||
XFlush(DADisplay);
|
|
||||||
}
|
|
||||||
|
|
||||||
Pixmap
|
|
||||||
DAMakePixmap(void)
|
|
||||||
{
|
|
||||||
return (XCreatePixmap(DADisplay, DAWindow, d_width, d_height, DADepth));
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
DAMakePixmapFromData(char **data, Pixmap *pixmap, Pixmap *mask,
|
|
||||||
unsigned *width, unsigned *height)
|
|
||||||
{
|
|
||||||
XpmAttributes xpmAttr;
|
|
||||||
|
|
||||||
xpmAttr.valuemask = XpmCloseness;
|
|
||||||
xpmAttr.closeness = 40000;
|
|
||||||
|
|
||||||
if (XpmCreatePixmapFromData(DADisplay, DAWindow, data,
|
|
||||||
pixmap, mask, &xpmAttr) != 0)
|
|
||||||
return False;
|
|
||||||
|
|
||||||
*width = xpmAttr.width;
|
|
||||||
*height = xpmAttr.height;
|
|
||||||
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999 Alfredo K. Kojima
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
* $Id: darect.c,v 1.1.1.1 2004/02/27 02:53:10 john Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dockapp.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
DAProcessActionRects(int x, int y, DAActionRect *actionrects, int count,
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
if (!actionrects)
|
|
||||||
return;
|
|
||||||
|
|
||||||
while ( (index < count) &&
|
|
||||||
((x < actionrects[index].rect.x) ||
|
|
||||||
(x > actionrects[index].rect.x + actionrects[index].rect.width) ||
|
|
||||||
(y < actionrects[index].rect.y) ||
|
|
||||||
(y > actionrects[index].rect.y + actionrects[index].rect.height)))
|
|
||||||
index++;
|
|
||||||
|
|
||||||
if (index == count)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (actionrects[index].action)
|
|
||||||
(*actionrects[index].action)(x - actionrects[index].rect.x,
|
|
||||||
y - actionrects[index].rect.y,
|
|
||||||
actionrects[index].rect,
|
|
||||||
data);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,253 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999 Alfredo K. Kojima
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
* $Id: dockapp.h,v 1.1.1.1 2004/02/27 02:53:10 john Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _DOCKAPP_H_
|
|
||||||
#define _DOCKAPP_H_
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is a simple (trivial) library for writing Window Maker dock
|
|
||||||
* applications, or dockapps (those that only show up in the dock), easily.
|
|
||||||
*
|
|
||||||
* It is very limited and can be only used for dockapps that open a single
|
|
||||||
* appicon for process in only ibe single display, but this seems to be
|
|
||||||
* enough for most, if not all, dockapps.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/xpm.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* the callbacks for events related to the dockapp window your program wants
|
|
||||||
* to handle
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
/* the dockapp window was destroyed */
|
|
||||||
void (*destroy)(void);
|
|
||||||
/* button pressed */
|
|
||||||
void (*buttonPress)(int button, int state, int x, int y);
|
|
||||||
/* button released */
|
|
||||||
void (*buttonRelease)(int button, int state, int x, int y);
|
|
||||||
/* pointer motion */
|
|
||||||
void (*motion)(int x, int y);
|
|
||||||
/* pointer entered dockapp window */
|
|
||||||
void (*enter)(void);
|
|
||||||
/* pointer left dockapp window */
|
|
||||||
void (*leave)(void);
|
|
||||||
/* timer expired */
|
|
||||||
void (*timeout)(void);
|
|
||||||
} DACallbacks;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *shortForm; /* short form for option, like -w */
|
|
||||||
char *longForm; /* long form for option, like --withdrawn */
|
|
||||||
char *description; /* description for the option */
|
|
||||||
|
|
||||||
short type; /* type of argument */
|
|
||||||
Bool used; /* if the argument was passed on the cmd-line */
|
|
||||||
|
|
||||||
/* the following are only set if the "used" field is True */
|
|
||||||
union {
|
|
||||||
void *ptr; /* a ptr for the value that was passed */
|
|
||||||
int *integer; /* on the command line */
|
|
||||||
char **string;
|
|
||||||
} value;
|
|
||||||
} DAProgramOption;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int x, y;
|
|
||||||
int width, height;
|
|
||||||
} DARect;
|
|
||||||
|
|
||||||
typedef void DARectCallback(int x, int y, DARect rect, void *data);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DARect rect;
|
|
||||||
DARectCallback *action;
|
|
||||||
} DAActionRect;
|
|
||||||
|
|
||||||
|
|
||||||
/* option argument types */
|
|
||||||
enum {
|
|
||||||
DONone, /* simple on/off flag */
|
|
||||||
DOInteger, /* an integer number */
|
|
||||||
DOString, /* a string */
|
|
||||||
DONatural /* positive integer number */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern Display *DADisplay;
|
|
||||||
extern Window DAWindow;
|
|
||||||
extern int DADepth;
|
|
||||||
extern Visual *DAVisual;
|
|
||||||
extern GC DAGC;
|
|
||||||
extern DARect DANoRect;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAParseArguments-
|
|
||||||
* Command line arguments parser. The program is exited if there are
|
|
||||||
* syntax errors.
|
|
||||||
*
|
|
||||||
* -h, --help and --version are automatically handled (causing the program
|
|
||||||
* to exit)
|
|
||||||
* -w is handled automatically as well and causes the dockapp to be run
|
|
||||||
* in windowed mode.
|
|
||||||
*/
|
|
||||||
void DAParseArguments(int argc, char **argv, DAProgramOption *options,
|
|
||||||
int count, char *programDescription, char *versionDescription);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAInitialize-
|
|
||||||
* Initialize the dockapp, open a connection to the X Server,
|
|
||||||
* create the needed windows and set them up to become an appicon window.
|
|
||||||
* It will automatically detect if Window Maker is present and use
|
|
||||||
* an appropriate window form.
|
|
||||||
*
|
|
||||||
* You must call this always before calling anything else (except for
|
|
||||||
* DAParseArguments())
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* display - the name of the display to connect to.
|
|
||||||
* Use "" to use the default value.
|
|
||||||
* name - the name of your dockapp, used as the instance name
|
|
||||||
* for the WM_CLASS hint. Like wmyaclock.
|
|
||||||
* The ClassName is set to "DockApp" on default.
|
|
||||||
* width, height - the size of the dockapp window. 48x48 is the
|
|
||||||
* preferred size.
|
|
||||||
* argc, argc - the program arguments. argv[0] will be used
|
|
||||||
* as the instance name for the WM_CLASS hint.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DAInitialize(display, name, width, height, argc, argv) \
|
|
||||||
DAGetDisplay(display, argc, argv); \
|
|
||||||
DACreateIcon(name, width, height, argc, argv);
|
|
||||||
|
|
||||||
|
|
||||||
void DAGetDisplay(char *display, int argc, char **argv);
|
|
||||||
|
|
||||||
void DACreateIcon(char *name, unsigned width, unsigned height,
|
|
||||||
int argc, char **argv);
|
|
||||||
|
|
||||||
void DAProposeIconSize(unsigned width, unsigned height);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DASetShapeWithOffset-
|
|
||||||
* Sets the shape mask of the dockapp to the specified one. This is
|
|
||||||
* optional. If you pass None as shapeMask, the dockapp will become
|
|
||||||
* non-shaped.
|
|
||||||
*
|
|
||||||
* This is only needed if you want the dockapp to be shaped.
|
|
||||||
*/
|
|
||||||
#define DASetShape(shapeMask) (DASetShapeWithOffset((shapeMask), 0, 0))
|
|
||||||
void DASetShapeWithOffset(Pixmap shapeMask, int x_ofs, int y_ofs);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DASetPixmap-
|
|
||||||
* Sets the image pixmap for the dockapp. Once you set the image with it,
|
|
||||||
* you don't need to handle expose events.
|
|
||||||
*/
|
|
||||||
void DASetPixmap(Pixmap pixmap);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAMakePixmap-
|
|
||||||
* Creates a pixmap suitable for use with DASetPixmap()
|
|
||||||
*/
|
|
||||||
Pixmap DAMakePixmap(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAMakePixmapFromData-
|
|
||||||
* Creates a pixmap and mask from XPM data
|
|
||||||
*/
|
|
||||||
Bool DAMakePixmapFromData(char **data, Pixmap *pixmap, Pixmap *mask,
|
|
||||||
unsigned *width, unsigned *height);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAGetColor-
|
|
||||||
* Returns a color.
|
|
||||||
*/
|
|
||||||
unsigned long DAGetColor(char *colorName);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAShow-
|
|
||||||
* Opens the dockapp.
|
|
||||||
*
|
|
||||||
* Always call this function or the dockapp won't show up.
|
|
||||||
*/
|
|
||||||
void DAShow(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DASetCallbacks-
|
|
||||||
* Register a set of callbacks for events like mouse clicks.
|
|
||||||
*
|
|
||||||
* Only needed if you want to receive some event.
|
|
||||||
*/
|
|
||||||
void DASetCallbacks(DACallbacks *callbacks);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DASetTimeout-
|
|
||||||
* Sets a timeout for the DAEventLoop(). The timeout callback
|
|
||||||
* will be called whenever the app doesn't get any events from the
|
|
||||||
* X server in the specified time.
|
|
||||||
*/
|
|
||||||
void DASetTimeout(int miliseconds);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DANextEventOrTimeout-
|
|
||||||
* Waits until a event is received or the timeout limit has
|
|
||||||
* expired. Returns True if an event was received.
|
|
||||||
*/
|
|
||||||
Bool DANextEventOrTimeout(XEvent *event, unsigned long miliseconds);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAProcessEvent-
|
|
||||||
* Processes an event. Returns True if the event was handled and
|
|
||||||
* False otherwise.
|
|
||||||
*
|
|
||||||
* Must be called from your event loop, unless you use DAEventLoop()
|
|
||||||
*/
|
|
||||||
Bool DAProcessEvent(XEvent *event);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAEventLoop-
|
|
||||||
* Enters an event loop where events are processed until the dockapp
|
|
||||||
* is closed. This function never returns.
|
|
||||||
*/
|
|
||||||
void DAEventLoop(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DAProcessActionRects-
|
|
||||||
* Processes the current coordinates for the functions in the array of
|
|
||||||
* action rectangles, converting coordinates to relative coordinates in
|
|
||||||
* the rectangles. The last item must be NULL.
|
|
||||||
*/
|
|
||||||
void DAProcessActionRects(int x, int y, DAActionRect *actionrects,
|
|
||||||
int count, void *data);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in a new issue