mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-04 21:04:18 +01:00
Initial revision
This commit is contained in:
15
test/Makefile.am
Normal file
15
test/Makefile.am
Normal file
@@ -0,0 +1,15 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
EXTRA_DIST = notest.c
|
||||
|
||||
noinst_PROGRAMS = wtest
|
||||
|
||||
wtest_SOURCES = wtest.c
|
||||
|
||||
wtest_LDADD = -L$(top_builddir)/wmlib -lWMaker @XLFLAGS@ @XLIBS@
|
||||
|
||||
|
||||
INCLUDES = -g -D_BSD_SOURCE @XCFLAGS@ -I$(top_srcdir)/wmlib
|
||||
|
||||
277
test/Makefile.in
Normal file
277
test/Makefile.in
Normal file
@@ -0,0 +1,277 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CPP_PATH = @CPP_PATH@
|
||||
DFLAGS = @DFLAGS@
|
||||
GFXFLAGS = @GFXFLAGS@
|
||||
GFXLIBS = @GFXLIBS@
|
||||
I18N = @I18N@
|
||||
I18N_MB = @I18N_MB@
|
||||
ICONEXT = @ICONEXT@
|
||||
INTLIBS = @INTLIBS@
|
||||
LIBPL_INC_PATH = @LIBPL_INC_PATH@
|
||||
LIBPL_LIBS = @LIBPL_LIBS@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MOFILES = @MOFILES@
|
||||
NLSDIR = @NLSDIR@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
REDUCE_APPICONS = @REDUCE_APPICONS@
|
||||
SHAPE = @SHAPE@
|
||||
SOUND = @SOUND@
|
||||
VERSION = @VERSION@
|
||||
WPMOFILES = @WPMOFILES@
|
||||
XCFLAGS = @XCFLAGS@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XLFLAGS = @XLFLAGS@
|
||||
XLIBS = @XLIBS@
|
||||
XSHM = @XSHM@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LOCALE = @X_LOCALE@
|
||||
pixmapdir = @pixmapdir@
|
||||
wprefsdir = @wprefsdir@
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
EXTRA_DIST = notest.c
|
||||
|
||||
noinst_PROGRAMS = wtest
|
||||
|
||||
wtest_SOURCES = wtest.c
|
||||
|
||||
wtest_LDADD = -L$(top_builddir)/wmlib -lWMaker @XLFLAGS@ @XLIBS@
|
||||
|
||||
INCLUDES = -g -D_BSD_SOURCE @XCFLAGS@ -I$(top_srcdir)/wmlib
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I../src
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
wtest_OBJECTS = wtest.o
|
||||
wtest_DEPENDENCIES =
|
||||
wtest_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
SOURCES = $(wtest_SOURCES)
|
||||
OBJECTS = $(wtest_OBJECTS)
|
||||
|
||||
all: Makefile $(PROGRAMS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-noinstPROGRAMS:
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
|
||||
distclean-noinstPROGRAMS:
|
||||
|
||||
maintainer-clean-noinstPROGRAMS:
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
wtest: $(wtest_OBJECTS) $(wtest_DEPENDENCIES)
|
||||
@rm -f wtest
|
||||
$(LINK) $(wtest_LDFLAGS) $(wtest_OBJECTS) $(wtest_LDADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = test
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-noinstPROGRAMS mostlyclean-compile \
|
||||
mostlyclean-tags mostlyclean-generic
|
||||
|
||||
clean: clean-noinstPROGRAMS clean-compile clean-tags clean-generic \
|
||||
mostlyclean
|
||||
|
||||
distclean: distclean-noinstPROGRAMS distclean-compile distclean-tags \
|
||||
distclean-generic clean
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-noinstPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
|
||||
clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir info dvi installcheck \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
135
test/notest.c
Normal file
135
test/notest.c
Normal file
@@ -0,0 +1,135 @@
|
||||
/* quick and dirty test application that demonstrates: Notify grabbing
|
||||
*
|
||||
* TODO: remake
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <WMaker.h>
|
||||
|
||||
|
||||
Display *dpy;
|
||||
Window leader;
|
||||
WMAppContext *app;
|
||||
Atom delete_win;
|
||||
Atom prots[6];
|
||||
XWMHints *hints;
|
||||
WMMenu *menu;
|
||||
|
||||
|
||||
static void
|
||||
quit(void *foo, int item, Time time)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
hide(void *foo, int item, Time time)
|
||||
{
|
||||
WMHideApplication(app);
|
||||
}
|
||||
|
||||
|
||||
int notify_print( int id, XEvent *event, void *data )
|
||||
{
|
||||
printf( "Got notification 0x%x, window 0x%lx, data '%s'\n",
|
||||
id, event->xclient.data.l[1], (char *) data );
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
newwin(void *foo, int item, Time time)
|
||||
{
|
||||
Window win;
|
||||
XClassHint classhint;
|
||||
char title[100];
|
||||
|
||||
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
|
||||
0, 0, 200, 100, 0, 0, 0);
|
||||
prots[0] = delete_win;
|
||||
XSetWMProtocols(dpy, win, prots, 1);
|
||||
sprintf(title, "Notify Test Window");
|
||||
XStoreName(dpy, win, title);
|
||||
|
||||
/* set class hint */
|
||||
classhint.res_name = "notest";
|
||||
classhint.res_class = "Notest";
|
||||
XSetClassHint(dpy, win, &classhint);
|
||||
|
||||
hints = XAllocWMHints();
|
||||
/* set window group leader */
|
||||
hints->window_group = leader;
|
||||
hints->flags = WindowGroupHint;
|
||||
XSetWMHints(dpy, win, hints);
|
||||
|
||||
WMAppAddWindow(app, win);
|
||||
XMapWindow(dpy, win);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
XClassHint classhint;
|
||||
|
||||
dpy = XOpenDisplay("");
|
||||
if (!dpy) {
|
||||
puts("could not open display!");
|
||||
exit(1);
|
||||
}
|
||||
delete_win = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
|
||||
|
||||
leader = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 10, 10,
|
||||
0, 0, 0);
|
||||
/* set class hint */
|
||||
classhint.res_name = "notest";
|
||||
classhint.res_class = "Notest";
|
||||
XSetClassHint(dpy, leader, &classhint);
|
||||
|
||||
/* set window group leader to self */
|
||||
hints = XAllocWMHints();
|
||||
hints->window_group = leader;
|
||||
hints->flags = WindowGroupHint;
|
||||
XSetWMHints(dpy, leader, hints);
|
||||
|
||||
/* create app context */
|
||||
app = WMAppCreateWithMain(dpy, DefaultScreen(dpy), leader);
|
||||
menu = WMMenuCreate(app, "Notify Test Menu");
|
||||
WMMenuAddItem(menu, "Hide", (WMMenuAction)hide, NULL, NULL, NULL);
|
||||
WMMenuAddItem(menu, "Quit", (WMMenuAction)quit, NULL, NULL, NULL);
|
||||
|
||||
WMAppSetMainMenu(app, menu);
|
||||
WMRealizeMenus(app);
|
||||
|
||||
/* Get some WindowMaker notifications */
|
||||
WMNotifySet( app, WMN_APP_START, notify_print, (void *) "App start" );
|
||||
WMNotifySet( app, WMN_APP_EXIT, notify_print, (void *) "App end" );
|
||||
WMNotifySet( app, WMN_WIN_FOCUS, notify_print, (void *) "Focus in" );
|
||||
WMNotifySet( app, WMN_WIN_UNFOCUS, notify_print, (void *) "Focus out" );
|
||||
WMNotifySet( app, WMN_NOTIFY_ALL, notify_print, (void *) "Unknown type" );
|
||||
WMNotifyMaskUpdate( app ); /* Mask isn't actually set till we do this */
|
||||
|
||||
/* set command to use to startup this */
|
||||
XSetCommand(dpy, leader, argv, argc);
|
||||
|
||||
/* create first window */
|
||||
newwin(NULL, 0, 0);
|
||||
|
||||
|
||||
XFlush(dpy);
|
||||
while( 1 ) {
|
||||
XEvent ev;
|
||||
XNextEvent(dpy, &ev);
|
||||
if (ev.type==ClientMessage) {
|
||||
if (ev.xclient.data.l[0]==delete_win) {
|
||||
XDestroyWindow(dpy,ev.xclient.window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
WMProcessEvent(app, &ev);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
172
test/wtest.c
Normal file
172
test/wtest.c
Normal file
@@ -0,0 +1,172 @@
|
||||
/* quick and dirty test application that demonstrates: application hiding,
|
||||
* application defined titlebar button images, application defined
|
||||
* titlebar button actions, application menus, docking and
|
||||
* window manager commands
|
||||
*
|
||||
* Note that the windows don't have a window command menu.
|
||||
*
|
||||
* TODO: remake
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <WMaker.h>
|
||||
|
||||
static unsigned char bits[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
|
||||
static unsigned char mbits[] = {
|
||||
0xff, 0x03, 0xff, 0x01, 0xff, 0x00, 0x7f, 0x00, 0x3f, 0x00, 0x1f, 0x00,
|
||||
0x0f, 0x00, 0x07, 0x00, 0x03, 0x00, 0x01, 0x00};
|
||||
|
||||
|
||||
Display *dpy;
|
||||
Window leader;
|
||||
WMAppContext *app;
|
||||
|
||||
|
||||
static void
|
||||
callback(void *foo, int item, Time time)
|
||||
{
|
||||
printf("pushed item %i\n", item);
|
||||
}
|
||||
|
||||
static void
|
||||
quit(void *foo, int item, Time time)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
hide(void *foo, int item, Time time)
|
||||
{
|
||||
WMHideApplication(app);
|
||||
}
|
||||
|
||||
|
||||
Atom delete_win, miniaturize_win;
|
||||
Atom prots[6];
|
||||
GNUstepWMAttributes attr;
|
||||
XWMHints *hints;
|
||||
WMMenu *menu;
|
||||
WMMenu *submenu;
|
||||
int wincount=0;
|
||||
|
||||
static void
|
||||
newwin(void *foo, int item, Time time)
|
||||
{
|
||||
Window win;
|
||||
XClassHint classhint;
|
||||
char title[100];
|
||||
|
||||
wincount++;
|
||||
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
|
||||
10*wincount, 10*wincount, 200, 100, 0, 0, 0);
|
||||
prots[0] = delete_win;
|
||||
prots[1] = miniaturize_win;
|
||||
XSetWMProtocols(dpy, win, prots, 2);
|
||||
sprintf(title, "Test Window %i", wincount);
|
||||
XStoreName(dpy, win, title);
|
||||
|
||||
/* set class hint */
|
||||
classhint.res_name = "test";
|
||||
classhint.res_class = "Test";
|
||||
XSetClassHint(dpy, win, &classhint);
|
||||
|
||||
/* set WindowMaker hints */
|
||||
attr.flags = GSMiniaturizePixmapAttr|GSMiniaturizeMaskAttr;
|
||||
attr.miniaturize_pixmap =
|
||||
XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), bits, 10, 10);
|
||||
|
||||
attr.miniaturize_mask =
|
||||
XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), mbits, 10, 10);
|
||||
/*
|
||||
attr.flags |= GSWindowStyleAttr;
|
||||
attr.window_style = NSTitledWindowMask|NSClosableWindowMask;
|
||||
*/
|
||||
|
||||
WMSetWindowAttributes(dpy, win, &attr);
|
||||
|
||||
hints = XAllocWMHints();
|
||||
/* set window group leader */
|
||||
hints->window_group = leader;
|
||||
hints->flags = WindowGroupHint;
|
||||
XSetWMHints(dpy, win, hints);
|
||||
|
||||
WMAppAddWindow(app, win);
|
||||
XMapWindow(dpy, win);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
XClassHint classhint;
|
||||
|
||||
dpy = XOpenDisplay("");
|
||||
if (!dpy) {
|
||||
puts("could not open display!");
|
||||
exit(1);
|
||||
}
|
||||
delete_win = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
|
||||
miniaturize_win = XInternAtom(dpy, "_GNUSTEP_WM_MINIATURIZE_WINDOW",
|
||||
False);
|
||||
|
||||
leader = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 10, 10,
|
||||
0, 0, 0);
|
||||
/* set class hint */
|
||||
classhint.res_name = "test";
|
||||
classhint.res_class = "Test";
|
||||
XSetClassHint(dpy, leader, &classhint);
|
||||
|
||||
/* set window group leader to self */
|
||||
hints = XAllocWMHints();
|
||||
hints->window_group = leader;
|
||||
hints->flags = WindowGroupHint;
|
||||
XSetWMHints(dpy, leader, hints);
|
||||
|
||||
/* create app context */
|
||||
app = WMAppCreateWithMain(dpy, DefaultScreen(dpy), leader);
|
||||
menu = WMMenuCreate(app, "Test Menu");
|
||||
submenu = WMMenuCreate(app, "File");
|
||||
WMMenuAddSubmenu(menu, "File", submenu);
|
||||
|
||||
WMMenuAddItem(menu, "Hide", (WMMenuAction)hide, NULL, NULL, NULL);
|
||||
WMMenuAddItem(menu, "Quit", (WMMenuAction)quit, NULL, NULL, NULL);
|
||||
WMMenuAddItem(submenu, "New", (WMMenuAction)newwin, NULL, NULL, NULL);
|
||||
WMMenuAddItem(submenu, "Open", (WMMenuAction)callback, NULL, NULL, NULL);
|
||||
WMMenuAddItem(submenu, "Save", (WMMenuAction)callback, NULL, NULL, NULL);
|
||||
WMMenuAddItem(submenu, "Save As...", (WMMenuAction)callback, NULL, NULL, NULL);
|
||||
|
||||
WMAppSetMainMenu(app, menu);
|
||||
|
||||
WMRealizeMenus(app);
|
||||
|
||||
/* set command to use to startup this */
|
||||
XSetCommand(dpy, leader, argv, argc);
|
||||
|
||||
/* create first window */
|
||||
newwin(NULL, 0, 0);
|
||||
|
||||
|
||||
XFlush(dpy);
|
||||
puts("Run xprop on the test window to see the properties defined");
|
||||
while (wincount>0) {
|
||||
XEvent ev;
|
||||
XNextEvent(dpy, &ev);
|
||||
if (ev.type==ClientMessage) {
|
||||
if (ev.xclient.data.l[0]==delete_win) {
|
||||
XDestroyWindow(dpy,ev.xclient.window);
|
||||
wincount--;
|
||||
} else if (ev.xclient.data.l[0]==miniaturize_win) {
|
||||
puts("You've pushed the maximize window button");
|
||||
}
|
||||
}
|
||||
WMProcessEvent(app, &ev);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user