1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

added nana stuff

added lock option in docked icons
This commit is contained in:
kojima
1999-10-20 03:25:06 +00:00
parent 914648cc2b
commit eb87c40967
39 changed files with 1833 additions and 501 deletions

266
src/DI.h Normal file
View File

@@ -0,0 +1,266 @@
/*
* DI.h - support for invariants (assertions) using the gdb debugger.
*
* Copyright (c) 1997 Phil Maker
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* Id: DI.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _DI_h_
#define _DI_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* DI_LEVEL sets the level of invariant analogously to NDEBUG in assert.h
*
* DI_LEVEL == 2: invariants are always evaluated.
* DI_LEVEL == 1: evaluate invariants iff they have a true GUARD.
* DI_LEVEL == 0: invariants are never evaluated.
*/
#ifndef DI_LEVEL /* define DEFAULT for DI_LEVEL */
#define DI_LEVEL 1
#endif
/*
* DI_DEFAULT_GUARD - the default guard expression; an invariant is checked
* iff the guard is true. By default its always true.
*/
#ifndef DI_DEFAULT_GUARD
#define DI_DEFAULT_GUARD 1
#endif
/*
* DI_DEFAULT_PARAMS - the default value to be passed as the second argument
* to the handler macro when an invariant fails.
*/
#ifndef DI_DEFAULT_PARAMS
#define DI_DEFAULT_PARAMS /* nothing */
#endif
/*
* DI_DEFAULT_HANDLER - called when an error is detected by DI;
*/
#ifndef DI_DEFAULT_HANDLER /* define default handler */
#define DI_DEFAULT_HANDLER(e,f,l,p) \
@@echo e has failed at f:l with p\n@@ \
@@where@@ /* stack backtrace */
#endif /* DI_DEFAULT_HANDLER */
/*
* DI_MAKE_VALID_BREAKPOINT(e) - called whenever we generate a DI breakpoint;
* the aim is to make sure a breakpoint can be set at the current location
* and that any expressions will be evaluated by gdb correctly.
* This is the portable default; an architecture specific version
* is generated by the configure script into nana-config.h
*/
#ifndef DI_MAKE_VALID_BREAKPOINT
static volatile int _di_target;
#define DI_MAKE_VALID_BREAKPOINT(e) _di_target = 0
#endif
/*
* _DIGHPS - implements the DI macros, it comes in two variants:
*
* ifdefined(_NANA_FILTER_) then we are generating debugger commands
* else generating C text.
*/
#if DI_LEVEL == 2 /* always check the assertion */
#ifdef _NANA_FILTER_
#define _DIGHPS(e,g,h,p,s) \
@@break @__FILE__:__LINE__@@ \
@@condition $bpnum (!(e))@@ \
@@command $bpnum@@ \
@@silent@@ \
h(s,f,l,p) \
@@end@@
#else
#define _DIGHPS(e,g,h,p,s) DI_MAKE_VALID_BREAKPOINT(e)
#endif /* _NANA_FILTER_ */
#elif DI_LEVEL == 1 /* check it iff g is true */
#ifdef _NANA_FILTER_
#define _DIGHPS(e,g,h,p,s) \
@@break @__FILE__:__LINE__@@ \
@@condition $bpnum (g) && (!(e))@@ \
@@command $bpnum@@ \
@@silent@@ \
h(s,f,l,p) \
@@end@@
#else
#define _DIGHPS(e,g,h,p,s) DI_MAKE_VALID_BREAKPOINT(e)
#endif /* _NANA_FILTER_ */
#elif DI_LEVEL == 0 /* no assertions so just remove them */
#define _DIGHPS(e,g,h,p,s) /* nothing */
#endif /* DI_LEVEL */
/*
* DSG(e,g), DS(e) - are used to set variables in the debugger from
* within C programs. These convenience variables can then be
* used in invariants later on to refer to the previous state
* of the program.
*
* DS($x = x); ....; DI($x + 10 == x);
*/
#if DI_LEVEL == 2
#ifdef _NANA_FILTER_
#define DSG(e,g) \
@@break @__FILE__:__LINE__@@ \
@@command@@ \
@@silent@@ \
@@set e@@ \
@@cont@@ \
@@end@@
#else
#define DSG(e,g) DI_MAKE_VALID_BREAKPOINT(e)
#endif
#elif DI_LEVEL == 1
#ifdef _NANA_FILTER_
#define DSG(e,g) \
@@break @__FILE__:__LINE__ if g@@ \
@@command@@ \
@@silent@@ \
@@set e@@ \
@@cont@@ \
@@end@@
#else
#define DSG(e,g) DI_MAKE_VALID_BREAKPOINT(e)
#endif /* _NANA_FILTER_ */
#elif DI_LEVEL == 0
#define DSG(e,g) /* nothing */
#else
error DI_LEVEL should be 0 or 1 or 2
#endif
#define DS(e) DSG(e,DI_DEFAULT_GUARD)
/*
* And all the user macros; these are used to put in the default arguments.
* The name is used to determine the arguments; e.g. DIGH takes an expression
* to check; a guard and a handler as parameters. The letters in the names
* are in ascending order (i.e. DIGH(...) not DIHG(...)).
*
* DI[G][H][P] - it must be true (e) with an optional guard, handler and
* parameter for the handler.
* DN[G][H][P] - as for DI... except that (e) must never ever be true.
*/
#define DI(e) \
_DIGHPS(e,DI_DEFAULT_GUARD,DI_DEFAULT_HANDLER,DI_DEFAULT_PARAMS,"DI("#e")")
#define DIG(e,g) \
_DIGHPS(e,g,DI_DEFAULT_HANDLER,DI_DEFAULT_PARAMS,"DI("#e")")
#define DIH(e,h) \
_DIGHPS(e,DI_DEFAULT_GUARD,h,DI_DEFAULT_PARAMS,"DI("#e")")
#define DIP(e,p) \
_DIGHPS(e,DI_DEFAULT_GUARD,DI_DEFAULT_HANDLER,p,"DI("#e")")
#define DIGH(e,g,h) \
_DIGHPS(e,g,h,DI_DEFAULT_PARAMS,"DI("#e")")
#define DIGP(e,g,p) \
_DIGHPS(e,g,DI_DEFAULT_HANDLER,p,"DI("#e")")
#define DIHP(e,h,p) \
_DIGHPS(e,DI_DEFAULT_GUARD,h,p,"DI("#e")")
#define DIGHP(e,g,h,p) \
_DIGHPS(e,g,h,p,"DI("#e")")
#define DN(e) \
_DIGHPS((!(e)),DI_DEFAULT_GUARD,DI_DEFAULT_HANDLER,DI_DEFAULT_PARAMS,"DN("#e")")
#define DNG(e,g) \
_DIGHPS((!(e)),g,DI_DEFAULT_HANDLER,DI_DEFAULT_PARAMS,"DN("#e")")
#define DNH(e,h) \
_DIGHPS((!(e)),DI_DEFAULT_GUARD,h,DI_DEFAULT_PARAMS,"DN("#e")")
#define DNP(e,p) \
_DIGHPS((!(e)),DI_DEFAULT_GUARD,DI_DEFAULT_HANDLER,p,"DN("#e")")
#define DNGH(e,g,h) \
_DIGHPS((!(e)),g,h,DI_DEFAULT_PARAMS,"DN("#e")")
#define DNGP(e,g,p) \
_DIGHPS((!(e)),g,DI_DEFAULT_HANDLER,p,"DN("#e")")
#define DNHP(e,h,p) \
_DIGHPS((!(e)),DI_DEFAULT_GUARD,h,p,"DN("#e")")
#define DNGHP(e,g,h,p) \
_DIGHPS((!(e)),g,h,p,"DN("#e")")
#else /* defined(WITHOUT_NANA) */
#define DI(e) /* empty */
#define DIG(e,g) /* empty */
#define DIH(e,h) /* empty */
#define DIP(e,p) /* empty */
#define DIGH(e,g,h) /* empty */
#define DIGP(e,g,p) /* empty */
#define DIHP(e,h,p) /* empty */
#define DIGHP(e,g,h,p) /* empty */
#define DN(e) /* empty */
#define DNG(e,g) /* empty */
#define DNH(e,h) /* empty */
#define DNP(e,p) /* empty */
#define DNGH(e,g,h) /* empty */
#define DNGP(e,g,p) /* empty */
#define DNHP(e,h,p) /* empty */
#define DNGHP(e,g,h,p) /* empty */
#define DS(e) /* empty */
#define DSG(e,g) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _DI_h_ */

227
src/DL.h Normal file
View File

@@ -0,0 +1,227 @@
/*
* DL.h - support for logging (printf...) style debugging using gdb.
*
* Copyright (c) 1997 Phil Maker
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* Id: DL.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _DL_h_
#define _DL_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* DL_MAKE_VALID_BREAKPOINT() - used to make sure that we can put a
* breakpoint at this location. We default to a portable C expression
* which simply does an assignment. The configure script may override
* this (on an architecture basis) and replace it with something
* like asm("nop");
*/
#ifndef DL_MAKE_VALID_BREAKPOINT
static volatile int _dl_target;
#define DL_MAKE_VALID_BREAKPOINT() _dl_target = 0
#endif
/*
* DL_LEVEL sets the level of logging analogously to NDEBUG in assert.h
*
* DL_LEVEL == 2: always print.
* DL_LEVEL == 1: print iff the guard is true.
* DL_LEVEL == 0: never print.
*/
#ifndef DL_LEVEL /* define DEFAULT for DL_LEVEL */
#define DL_LEVEL 1
#endif
/*
* DL_DEFAULT_HANDLER - the default print handler; by default we just
* the debugger printf.
*
* @@call (void) printf(f)@@
*/
#ifndef DL_DEFAULT_HANDLER /* define default handler */
#define DL_DEFAULT_HANDLER(g,h,p,f...) @@printf f@@
#endif /* DL_DEFAULT_HANDLER */
/*
* DL_DEFAULT_GUARD - the default guard expression; a message is printed
* iff the guard is true. By default its always true.
*/
#ifndef DL_DEFAULT_GUARD
#define DL_DEFAULT_GUARD (1)
#endif
/*
* DL_DEFAULT_PARAMS - the default value to be passed as the second argument
* to the handler macro when an invariant fails.
*/
#ifndef DL_DEFAULT_PARAMS
#define DL_DEFAULT_PARAMS stderr
#endif
/*
* DL_SHOW_TIME - if its defined then each message gets a timestamp in front.
*/
#ifdef DL_SHOW_TIME
unsigned long _L_gettime(void); /* returns the current time */
#define _DL_SHOWTIME(h,p) @@call (void) h (p, "%-8ld ", _L_gettime())@@
#else
#define _DL_SHOWTIME(h,p) /* nothing */
#endif /* DL_SHOWTIME */
/*
* DLGHP(g,h,p,f...) - print a log message.
*
* g - the guard; print the message iff this is true
* h - the handler function that does the actual printing
* p - a parameter for the handler function; e.g. a file descriptor.
* f - the format and the data...
*/
#if DL_LEVEL == 2 /* always log the message */
#ifdef _NANA_FILTER_
#define DLGHP(g,h,p,f...) \
do { \
@@break @__FILE__:__LINE__@@ \
@@command $bpnum@@ \
@@silent@@ \
_DL_SHOWTIME(h,p); \
DL_DEFAULT_HANDLER(g,h,p,##f); \
@@cont@@ \
@@end@@ \
} while(0)
#else
#define DLGHP(g,h,p,f...) DL_MAKE_VALID_BREAKPOINT()
#endif
#elif DL_LEVEL == 1 /* log it iff the guard is true */
#ifdef _NANA_FILTER_
#define DLGHP(g,h,p,f...) \
do { \
if(g) { \
@@break @__FILE__:__LINE__@@ \
@@condition $bpnum g@@ \
@@command $bpnum@@ \
@@silent@@ \
_DL_SHOWTIME(h,p); \
DL_DEFAULT_HANDLER(g,h,p,##f); \
@@cont@@ \
@@end@@ \
} \
} while(0)
#else
#define DLGHP(g,h,p,f...) DL_MAKE_VALID_BREAKPOINT()
#endif
#elif DL_LEVEL == 0 /* no logging so ignore them */
#define DLGHP(g,h,p,f...) /* nothing */
#endif /* DL_LEVEL */
/*
* And the user routines.
*/
#define DL(f...) \
DLGHP(DL_DEFAULT_GUARD,DL_DEFAULT_HANDLER,DL_DEFAULT_PARAMS,##f)
#define DLG(g,f...) \
DLGHP(g,DL_DEFAULT_HANDLER,DL_DEFAULT_PARAMS,##f)
#define DLH(h,f...) \
DLGHP(DL_DEFAULT_GUARD,h,DL_DEFAULT_PARAMS,##f)
#define DLP(p,f...) \
DLGHP(DL_DEFAULT_GUARD,DL_DEFAULT_HANDLER,p,##f)
#define DLGP(g,p,f...) \
DLGHP(g,DL_DEFAULT_HANDLER,p,##f)
#define DLHP(h,p,f...) \
DLGHP(DL_DEFAULT_GUARD,h,p,##f)
/*
* V* - since the DL* macros take a variable numbers of arguments we
* have problems compiling calls to L with C preprocessors other
* than GNU cccp. The V* macros are called using a bracketed arglist, e.g.
* VDL((s,x,y))
*
* if we are compiling with GNU C then they simply call the normal
* varargs macros. if we are not using GNU C then they map to empty.
*/
#define VDL(a) DL a
#define VDLG(a) DLG a
#define VDLH(a) DLH a
#define VDLP(a) DLP a
#define VDLGP(a) DLGP a
#define VDLHP(a) DLHP a
#define VDLGHP(a) DLGHP a
#else /* defined(WITHOUT_NANA) */
#define VDL(a) /* empty */
#define VDLG(a) /* empty */
#define VDLH(a) /* empty */
#define VDLP(a) /* empty */
#define VDLGP(a) /* empty */
#define VDLHP(a) /* empty */
#define VDLGHP(a) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _DL_h_ */

90
src/GDB.h Normal file
View File

@@ -0,0 +1,90 @@
/*
* GDB.h - basic support macros for putting gdb commands in C.
*
* Copyright (c) 1997 Phil Maker
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* Id: GDB.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _GDB_h_
#define _GDB_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* GDB(c) - just puts the command into the output of nana
* c should be a single line of text
*/
#ifdef _NANA_FILTER_
#define GDB(command) @@command@@
#else
#define GDB(command) /* nothing */
#endif
/*
* GDBCALL(c) - calls a gdb command whenever control reaches the
* current line.
*/
#ifdef _NANA_FILTER_
#define GDBCALL(comd) \
@@break @__FILE__:__LINE__@@ \
@@command@@ \
@@silent@@ \
@@comd@@ \
@@cont@@ \
@@end@@
#else
#define GDBCALL(c) DI_MAKE_VALID_BREAKPOINT(1)
#endif
#else /* defined(WITHOUT_NANA) */
#define GDB(e) /* empty */
#define GDBCALL(e) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _GDB_h_ */

234
src/I.h Normal file
View File

@@ -0,0 +1,234 @@
/*
* I.h - support for invariants (assertions) using C code.
*
* Copyright (c) 1997 Phil Maker
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* Id: I.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _I_h_
#define _I_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* I_LEVEL sets the level of invariant analogously to NDEBUG in assert.h
*
* I_LEVEL == 2: invariants are always evaluated.
* I_LEVEL == 1: evaluate invariants iff they have a true GUARD.
* I_LEVEL == 0: invariants are never evaluated.
*/
#ifndef I_LEVEL /* define DEFAULT for I_LEVEL */
#define I_LEVEL 1
#endif
/*
* I_DEFAULT_GUARD - the default guard expression; an invariant is checked
* iff the guard is true. By default its always true.
*/
#ifndef I_DEFAULT_GUARD
#define I_DEFAULT_GUARD (1)
#endif
/*
* I_DEFAULT_PARAMS - the default value to be passed as the second argument
* to the handler macro when an invariant fails.
*/
#ifndef I_DEFAULT_PARAMS
#define I_DEFAULT_PARAMS /* nothing */
#endif
/*
* I_DEFAULT_HANDLER(expr,file,line,param) - called when an error is detected.
*/
#ifndef I_DEFAULT_HANDLER /* define default handler */
void _I_default_handler(char *expr, char *file, int line);
#define I_DEFAULT_HANDLER(expr,file,line,param) \
_I_default_handler(expr,__FILE__,__LINE__)
#endif /* I_DEFAULT_HANDLER */
/*
* _IGHPS(e,g,h,p,s) - implements the general case for invariant handling.
*
* e - expression to check
* g - guard, check only if this is true (subject to I_DEFAULT_LEVEL)
* h - handler, called when a failure is detected
* p - parameter to pass off to the handler
* s - string representation of the expression (e.g. "I(x>=i)")
*
* _ISD(e) - generates a data declaration for use in postconditions
* _ISG(e,g) - generates a guarded assignment to a data declaration
* for use in postconditions
*
* N.B. The two types are necessary since we cannot guard a C declaration
* with an if statement.
*/
#if I_LEVEL == 2 /* always check the assertion */
#define _IGHPS(e,g,h,p,s) \
do { \
if(!(e)) { \
h (s, __FILE__, __LINE__, p); \
} \
} while(0)
#define _ID(e) e
#define _ISG(e,g) e
#elif I_LEVEL == 1 /* check it iff g is true */
#define _IGHPS(e,g,h,p,s) \
do { \
if(g) { \
if(!(e)) { \
h (s, __FILE__, __LINE__, p); \
} \
} \
} while(0)
#define _ID(e) e
#define _ISG(e,g) \
do { \
if(g) { \
e; \
} \
} while(0)
#elif I_LEVEL == 0 /* no assertions so just remove them */
#define _IGHPS(e,g,h,p,s) /* nothing */
#define _ID(e) /* nothing */
#define _ISG(e,g) /* nothing */
#endif /* I_LEVEL */
/*
* And all the user macros; these are used to put in the default arguments.
* The name is used to determine the arguments; e.g. IGH takes an expression
* to check; a guard and a handler as parameters. The letters in the names
* are in ascending order (i.e. IGH(...) not IHG(...)).
*
* I[G][H][P] - it must be true (e) with an optional guard, handler and
* parameter for the handler.
* N[G][H][P] - as for I... except that (e) must never ever be true.
*/
#define I(e) \
_IGHPS(e,I_DEFAULT_GUARD,I_DEFAULT_HANDLER,I_DEFAULT_PARAMS,"I("#e")")
#define IG(e,g) \
_IGHPS(e,g,I_DEFAULT_HANDLER,I_DEFAULT_PARAMS,"I("#e")")
#define IH(e,h) \
_IGHPS(e,I_DEFAULT_GUARD,h,I_DEFAULT_PARAMS,"I("#e")")
#define IP(e,p) \
_IGHPS(e,I_DEFAULT_GUARD,I_DEFAULT_HANDLER,p,"I("#e")")
#define IGH(e,g,h) \
_IGHPS(e,g,h,I_DEFAULT_PARAMS,"I("#e")")
#define IGP(e,g,p) \
_IGHPS(e,g,I_DEFAULT_HANDLER,p,"I("#e")")
#define IHP(e,h,p) \
_IGHPS(e,I_DEFAULT_GUARD,h,p,"I("#e")")
#define IGHP(e,g,h,p) \
_IGHPS(e,g,h,p,"I("#e")")
#define N(e) \
_IGHPS((!(e)),I_DEFAULT_GUARD,I_DEFAULT_HANDLER,I_DEFAULT_PARAMS,"N("#e")")
#define NG(e,g) \
_IGHPS((!(e)),g,I_DEFAULT_HANDLER,I_DEFAULT_PARAMS,"N("#e")")
#define NH(e,h) \
_IGHPS((!(e)),I_DEFAULT_GUARD,h,I_DEFAULT_PARAMS,"N("#e")")
#define NP(e,p) \
_IGHPS((!(e)),I_DEFAULT_GUARD,I_DEFAULT_HANDLER,p,"N("#e")")
#define NGH(e,g,h) \
_IGHPS((!(e)),g,h,I_DEFAULT_PARAMS,"N("#e")")
#define NGP(e,g,p) \
_IGHPS((!(e)),g,I_DEFAULT_HANDLER,p,"N("#e")")
#define NHP(e,h,p) \
_IGHPS((!(e)),I_DEFAULT_GUARD,h,p,"N("#e")")
#define NGHP(e,g,h,p) \
_IGHPS((!(e)),g,h,p,"N("#e")")
/*
* ID(e) - declares a variable to be used to store values for a postcondition.
* This can include an initialiser.
* Note this declaration is not disabled by I_DEFAULT_GUARD
* IS(e) - an assignment to a variable. This statement is enabled by
* I_DEFAULT_GUARD
* ISG(e,g) - the guarded version of IS
*/
#define ID(e) _ID(e)
#define IS(e) _ISG(e,I_DEFAULT_GUARD)
#define ISG(e,g) _ISG(e,g)
#else /* defined(WITHOUT_NANA) */
#define I(e) /* empty */
#define IG(e,g) /* empty */
#define IH(e,h) /* empty */
#define IP(e,p) /* empty */
#define IGH(e,g,h) /* empty */
#define IGP(e,g,p) /* empty */
#define IHP(e,h,p) /* empty */
#define IGHP(e,g,h,p) /* empty */
#define N(e) /* empty */
#define NG(e,g) /* empty */
#define NH(e,h) /* empty */
#define NP(e,p) /* empty */
#define NGH(e,g,h) /* empty */
#define NGP(e,g,p) /* empty */
#define NHP(e,h,p) /* empty */
#define NGHP(e,g,h,p) /* empty */
#define ID(e) /* empty */
#define IS(e) /* empty */
#define ISG(e,g) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _I_h_ */

207
src/L.h Normal file
View File

@@ -0,0 +1,207 @@
/*
* L.h - support for logging (printf...) style debugging.
*
* Copyright (c) 1997 Phil Maker
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* Id: L.h,v 1.2 1998/01/17 10:57:03 pjm Exp
*/
#ifndef _L_h_
#define _L_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* L_LEVEL sets the level of logging analogously to NDEBUG in assert.h
*
* L_LEVEL == 2: always print.
* L_LEVEL == 1: print iff the guard is true.
* L_LEVEL == 0: never print.
*/
#ifndef L_LEVEL /* define DEFAULT for L_LEVEL */
#define L_LEVEL 1
#endif
/*
* L_DEFAULT_HANDLER - the default print handler; by default we just
* use fprintf.
*/
#ifndef L_DEFAULT_HANDLER /* define default handler */
#define L_DEFAULT_HANDLER fprintf
#endif /* L_DEFAULT_HANDLER */
/*
* L_DEFAULT_GUARD - the default guard expression; a message is printed
* iff the guard is true. By default its always true.
*/
#ifndef L_DEFAULT_GUARD
#define L_DEFAULT_GUARD (1)
#endif
/*
* L_DEFAULT_PARAMS - the default value to be passed as the second argument
* to the handler macro when an invariant fails.
*/
#ifndef L_DEFAULT_PARAMS
#define L_DEFAULT_PARAMS stderr
#endif
/*
* L_SHOW_TIME_FORMAT - the format string for printing the time.
*/
#ifndef L_SHOW_TIME_FORMAT
#define L_SHOW_TIME_FORMAT "%.6f:\t"
#endif
/*
* L_SHOW_TIME_NOW - the function to measure the time.
*/
#ifndef L_SHOW_TIME_NOW
#include <now.h>
#define L_SHOW_TIME_NOW now()
#endif
/*
* L_SHOW_TIME - if it is defined then we will put time stamps at the
* beginning of each message using L_SHOW_TIME_FORMAT and L_SHOW_TIME_NOW.
*/
#ifdef L_SHOW_TIME
#define _L_SHOWTIME(h,p) h (p, L_SHOW_TIME_FORMAT, L_SHOW_TIME_NOW)
#else
#define _L_SHOWTIME(h,p) /* nothing */
#endif /* L_SHOWTIME */
/*
* LGHP(g,h,p, f...) - print a log message.
*
* g - the guard; print the message iff this is true
* h - the handler function that does the actual printing
* p - a parameter for the handler function; e.g. a file descriptor.
* f - printf style format string; we put this at the end since we
* we need to be able have 1 or more arguments (e.g. L("x") and
* L("%d",10); we use GNU cccp preprocessor varargs extension
* to handle multiple arguments.
*/
#ifndef __GNUC__
error you need gcc for this stuff to work properly
#endif
#if L_LEVEL == 2 /* always log the message */
#define LGHP(g,h,p,f...) \
do { \
_L_SHOWTIME(h,p); \
h (p, ##f); \
} while(0)
#elif L_LEVEL == 1 /* log it iff the guard is true */
#define LGHP(g,h,p,f...) \
do { \
if(g) { \
_L_SHOWTIME(h,p); \
h (p, ##f); \
} \
} while(0)
#elif L_LEVEL == 0 /* no logging so ignore them */
#define LGHP(g,h,p,f...) /* nothing */
#endif /* L_LEVEL */
/*
* User routines.
*/
#define L(f...) \
LGHP(L_DEFAULT_GUARD,L_DEFAULT_HANDLER,L_DEFAULT_PARAMS,##f)
#define LG(g,f...) \
LGHP(g,L_DEFAULT_HANDLER,L_DEFAULT_PARAMS,##f)
#define LH(h,f...) \
LGHP(L_DEFAULT_GUARD,h,L_DEFAULT_PARAMS,##f)
#define LP(p,f...) \
LGHP(L_DEFAULT_GUARD,L_DEFAULT_HANDLER,p,##f)
#define LGP(g,p,f...) \
LGHP(g,L_DEFAULT_HANDLER,p,##f)
#define LHP(h,p,f...) \
LGHP(L_DEFAULT_GUARD,h,p,##f)
/*
* V* - since the L* macros take a variable numbers of arguments we
* have problems compiling calls to L with C preprocessors other
* than GNU cccp. The V* macros are called using a bracketed
* argument list, e.g. VL((f,x,s));
*
* if we are compiling with GNU C then they simpily call the normal
* varargs macro. if we are not using GNU CC then they map to empty.
*/
#define VL(a) L a
#define VLG(a) LG a
#define VLH(a) LH a
#define VLP(a) LP a
#define VLGP(a) LGP a
#define VLHP(a) LHP a
#define VLGHP(a) LGHP a
#else /* defined(WITHOUT_NANA) */
#define VL(a) /* empty */
#define VLG(a) /* empty */
#define VLH(a) /* empty */
#define VLP(a) /* empty */
#define VLGP(a) /* empty */
#define VLHP(a) /* empty */
#define VLGHP(a) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _L_h_ */

View File

@@ -4,7 +4,8 @@ BUILT_SOURCES = wconfig.h
bin_PROGRAMS = wmaker
EXTRA_DIST = wmnotify.c wmnotdef.h wmnotify.h
EXTRA_DIST = wmnotify.c wmnotdef.h wmnotify.h\
DI.h DL.h I.h L.h Q.h GDB.h nana.h
wmaker_SOURCES = \

View File

@@ -98,7 +98,8 @@ BUILT_SOURCES = wconfig.h
bin_PROGRAMS = wmaker
EXTRA_DIST = wmnotify.c wmnotdef.h wmnotify.h
EXTRA_DIST = wmnotify.c wmnotdef.h wmnotify.h DI.h DL.h I.h L.h Q.h GDB.h nana.h
wmaker_SOURCES = GNUstep.h WindowMaker.h actions.c actions.h appicon.c appicon.h application.c application.h appmenu.c appmenu.h balloon.c balloon.h client.c client.h colormap.c def_pixmaps.h defaults.c defaults.h dialog.c dialog.h dock.c dockedapp.c dock.h event.c extend_pixmaps.h framewin.c framewin.h gnome.c gnome.h funcs.h icon.c icon.h keybind.h kwm.h kwm.c main.c menu.c menu.h misc.c motif.c motif.h moveres.c openlook.c openlook.h pixmap.c pixmap.h placement.c plugin.c plugin.h properties.c properties.h proplist.c resources.c resources.h rootmenu.c screen.c screen.h session.h session.c shutdown.c stacking.c stacking.h startup.c superfluous.c superfluous.h switchmenu.c texture.c texture.h usermenu.c usermenu.h xdnd.h xdnd.c xmodifier.h xmodifier.c xutil.c xutil.h wconfig.h wcore.c wcore.h wdefaults.c wdefaults.h window.c window.h winmenu.c winspector.h winspector.c workspace.c workspace.h wmsound.c wmsound.h text.c text.h
@@ -144,7 +145,7 @@ wconfig.h.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
TAR = gtar
GZIP_ENV = --best
SOURCES = $(wmaker_SOURCES)
OBJECTS = $(wmaker_OBJECTS)

160
src/Q.h Normal file
View File

@@ -0,0 +1,160 @@
/*
* Q.h - support for ForAll, ThereExists, Count and Sum (i.e. quantifiers).
*
* Portability: this file uses the GNU C Statement Expression extension and
* so requires GCC/C++ with extensions enabled (this is checked by the
* header file).
*
* Copyright (c) 1997 Phil Maker
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* Id: Q.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _Q_h_
#define _Q_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
#ifndef __GNUC__ /* not compiling with GCC/G++ extensions */
error
This file requires the GNU C/C++ "statement expression" extension;
so use GCC/G++ with extensions enabled. If you have not got GCC then
misery follows though we may be able to do something about it
in the future.
#endif
/*
* A(i,c,n,a) - true iff a is true for all values generated by for(i;c;n)
*
* Note: local variables can be introduced in this statement even in C.
*/
#define A(i,c,n,a) /* ForAll */ \
({ \
int _A_result = 1; \
i; \
while(c) { \
if(!(a)) { \
_A_result = 0; \
break; \
} \
n; \
} \
_A_result; \
})
/*
* E(i,c,n,a) - true iff exists any true a for values generated by for(i;c;n)
*/
#define E(i,c,n,a) /* Exists */ \
({ \
int _E_result = 0; \
i; \
while(c) { \
if(a) { \
_E_result = 1; \
break; \
} \
n; \
} \
_E_result; \
})
/*
* C(i,c,n,a) - count the number of times a is true over the values
* generated by for(i;c;n)
*/
#define C(i,c,n,a) /* Count */ \
({ \
long _C_result = 0; \
i; \
while(c) { \
if(a) { \
_C_result++; \
} \
n; \
} \
_C_result; \
})
/*
* E1(i,c,n,a) - exists a single value generated by for(i;c;n)
* suchthat i is true.
*/
#define E1(i,c,n,a) (C(i,c,n,a) == 1) /* There Exists 1 */
/*
* S(i,c,n,v) - sum of v over the values generated by for(i;c;n)
*/
#define S(i,c,n,v) \
({ \
i; \
typeof(v) _S_result = 0; \
while(c) { \
_S_result += (v); \
n; \
} \
_S_result; \
})
/*
* P(i,c,n,v) - product of v over the values generated by for(i;c;n)
*/
#define P(i,c,n,v) \
({ \
i; \
typeof(v) _P_result = 1; \
while(c) { \
_P_result *= (v); \
n; \
} \
_P_result; \
})
#else /* defined(WITHOUT_NANA) */
/*
* we don't produce any empty stubs for Q.h when compiling without nana
* since calls to A(...), etc should only occur in stubbed out code such
* as I(...).
*/
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _Q_h_ */

View File

@@ -271,6 +271,8 @@ typedef struct WPreferences {
/* paths to find pixmaps */
char *icon_path; /* : separated list of */
/* paths to find icons */
char *logger_shell; /* shell to log child stdi/o */
RImage *button_images; /* titlebar button images */

View File

@@ -91,6 +91,9 @@ typedef struct WAppIcon {
unsigned int destroyed:1; /* appicon was destroyed */
unsigned int buggy_app:1; /* do not make dock rely on hints
* set by app */
unsigned int lock:1; /* do not allow to be destroyed */
#ifdef REDUCE_APPICONS
unsigned int num_apps; /* length of applist */
#endif

View File

@@ -100,7 +100,8 @@ static proplist_t dCommand=NULL;
#ifdef OFFIX_DND
static proplist_t dDropCommand=NULL;
#endif
static proplist_t dAutoLaunch, dName, dForced, dBuggyApplication, dYes, dNo;
static proplist_t dAutoLaunch, dLock;
static proplist_t dName, dForced, dBuggyApplication, dYes, dNo;
static proplist_t dHost, dDock, dClip;
static proplist_t dAutoAttractIcons;
@@ -169,6 +170,7 @@ make_keys()
#ifdef OFFIX_DND
dDropCommand = PLRetain(PLMakeString("DropCommand"));
#endif
dLock = PLRetain(PLMakeString("Lock"));
dAutoLaunch = PLRetain(PLMakeString("AutoLaunch"));
dName = PLRetain(PLMakeString("Name"));
dForced = PLRetain(PLMakeString("Forced"));
@@ -1327,7 +1329,7 @@ static proplist_t
make_icon_state(WAppIcon *btn)
{
proplist_t node = NULL;
proplist_t command, autolaunch, name, forced, host, position, buggy;
proplist_t command, autolaunch, lock, name, forced, host, position, buggy;
proplist_t omnipresent;
char *tmp;
char buffer[64];
@@ -1340,6 +1342,8 @@ make_icon_state(WAppIcon *btn)
autolaunch = btn->auto_launch ? dYes : dNo;
lock = btn->lock ? dYes : dNo;
tmp = EscapeWM_CLASS(btn->wm_instance, btn->wm_class);
name = PLMakeString(tmp);
@@ -1359,6 +1363,7 @@ make_icon_state(WAppIcon *btn)
node = PLMakeDictionaryFromEntries(dCommand, command,
dName, name,
dAutoLaunch, autolaunch,
dLock, lock,
dForced, forced,
dBuggyApplication, buggy,
dPosition, position,
@@ -1511,6 +1516,22 @@ wClipSaveWorkspaceState(WScreen *scr, int workspace)
}
static Bool
getBooleanDockValue(proplist_t value, proplist_t key)
{
if (value) {
if (PLIsString(value)) {
if (strcasecmp(PLGetString(value), "YES")==0)
return True;
} else {
wwarning(_("bad value in docked icon state info %s"),
PLGetString(key));
}
}
return False;
}
static WAppIcon*
restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
{
@@ -1579,44 +1600,22 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
/* check auto launch */
value = PLGetDictionaryEntry(info, dAutoLaunch);
aicon->auto_launch = 0;
if (value) {
if (PLIsString(value)) {
if (strcasecmp(PLGetString(value), "YES")==0)
aicon->auto_launch = 1;
} else {
wwarning(_("bad value in docked icon state info %s"),
PLGetString(dAutoLaunch));
}
}
aicon->auto_launch = getBooleanDockValue(value, dAutoLaunch);
/* check lock */
value = PLGetDictionaryEntry(info, dLock);
aicon->lock = getBooleanDockValue(value, dLock);
/* check if it wasn't normally docked */
value = PLGetDictionaryEntry(info, dForced);
aicon->forced_dock = 0;
if (value) {
if (PLIsString(value)) {
if (strcasecmp(PLGetString(value), "YES")==0)
aicon->forced_dock = 1;
} else {
wwarning(_("bad value in docked icon state info %s"),
PLGetString(dForced));
}
}
aicon->forced_dock = getBooleanDockValue(value, dForced);
/* check if we can rely on the stuff in the app */
value = PLGetDictionaryEntry(info, dBuggyApplication);
aicon->buggy_app = 0;
if (value) {
if (PLIsString(value)) {
if (strcasecmp(PLGetString(value), "YES")==0)
aicon->buggy_app = 1;
} else {
wwarning(_("bad value in docked icon state info %s"),
PLGetString(dBuggyApplication));
}
}
aicon->buggy_app = getBooleanDockValue(value, dBuggyApplication);
/* get position in the dock */
value = PLGetDictionaryEntry(info, dPosition);
@@ -1642,16 +1641,7 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
/* check if icon is omnipresent */
value = PLGetDictionaryEntry(info, dOmnipresent);
aicon->omnipresent = 0;
if (value) {
if (PLIsString(value)) {
if (strcasecmp(PLGetString(value), "YES")==0)
aicon->omnipresent = 1;
} else {
wwarning(_("bad value in docked icon state info %s"),
PLGetString(dOmnipresent));
}
}
aicon->omnipresent = getBooleanDockValue(value, dOmnipresent);
aicon->running = 0;
aicon->docked = 1;
@@ -3869,6 +3859,7 @@ handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
}
}
if (aicon->launching
|| aicon->lock
|| (aicon->running && !(ev.xmotion.state & MOD_MASK))
|| (!aicon->running && tmp)) {
shad_x = last_dock->x_pos + ix*wPreferences.icon_size;

View File

@@ -66,6 +66,7 @@ typedef struct _AppSettingsPanel {
WMButton *browseBtn;
WMButton *autoLaunchBtn;
WMButton *lockBtn;
WMButton *okBtn;
WMButton *cancelBtn;
@@ -246,6 +247,9 @@ panelBtnCallback(WMWidget *self, void *data)
panel->editedIcon->auto_launch =
WMGetButtonSelected(panel->autoLaunchBtn);
panel->editedIcon->lock =
WMGetButtonSelected(panel->lockBtn);
}
if (done)
@@ -254,7 +258,7 @@ panelBtnCallback(WMWidget *self, void *data)
#define PWIDTH 295
#define PHEIGHT 345
#define PHEIGHT 365
void
@@ -298,9 +302,16 @@ ShowDockAppSettingsPanel(WAppIcon *aicon)
_("Start when WindowMaker is started"));
WMSetButtonSelected(panel->autoLaunchBtn, aicon->auto_launch);
panel->lockBtn = WMCreateSwitchButton(panel->win);
WMResizeWidget(panel->lockBtn, PWIDTH-30, 20);
WMMoveWidget(panel->lockBtn, 15, 100);
WMSetButtonText(panel->lockBtn,
_("Lock (prevent accidental removal)"));
WMSetButtonSelected(panel->lockBtn, aicon->lock);
panel->commandFrame = WMCreateFrame(panel->win);
WMResizeWidget(panel->commandFrame, 275, 50);
WMMoveWidget(panel->commandFrame, 10, 105);
WMMoveWidget(panel->commandFrame, 10, 125);
WMSetFrameTitle(panel->commandFrame, _("Application path and arguments"));
panel->commandField = WMCreateTextField(panel->commandFrame);
@@ -310,7 +321,7 @@ ShowDockAppSettingsPanel(WAppIcon *aicon)
panel->dndCommandFrame = WMCreateFrame(panel->win);
WMResizeWidget(panel->dndCommandFrame, 275, 70);
WMMoveWidget(panel->dndCommandFrame, 10, 165);
WMMoveWidget(panel->dndCommandFrame, 10, 185);
WMSetFrameTitle(panel->dndCommandFrame,
_("Command for files dropped with DND"));
@@ -333,7 +344,7 @@ ShowDockAppSettingsPanel(WAppIcon *aicon)
panel->iconFrame = WMCreateFrame(panel->win);
WMResizeWidget(panel->iconFrame, 275, 50);
WMMoveWidget(panel->iconFrame, 10, 245);
WMMoveWidget(panel->iconFrame, 10, 265);
WMSetFrameTitle(panel->iconFrame, _("Icon Image"));
panel->iconField = WMCreateTextField(panel->iconFrame);
@@ -352,13 +363,13 @@ ShowDockAppSettingsPanel(WAppIcon *aicon)
panel->okBtn = WMCreateCommandButton(panel->win);
WMResizeWidget(panel->okBtn, 80, 26);
WMMoveWidget(panel->okBtn, 200, 308);
WMMoveWidget(panel->okBtn, 200, 328);
WMSetButtonText(panel->okBtn, _("OK"));
WMSetButtonAction(panel->okBtn, panelBtnCallback, panel);
panel->cancelBtn = WMCreateCommandButton(panel->win);
WMResizeWidget(panel->cancelBtn, 80, 26);
WMMoveWidget(panel->cancelBtn, 110, 308);
WMMoveWidget(panel->cancelBtn, 110, 328);
WMSetButtonText(panel->cancelBtn, _("Cancel"));
WMSetButtonAction(panel->cancelBtn, panelBtnCallback, panel);

View File

@@ -29,10 +29,13 @@
#include <unistd.h>
#include <string.h>
#include <nana.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef SHAPE
#include <X11/extensions/shape.h>
# include <X11/extensions/shape.h>
#endif
#ifdef XDND
#include "xdnd.h"
@@ -461,9 +464,8 @@ handleMapRequest(XEvent *ev)
Window window = ev->xmaprequest.window;
#ifdef DEBUG
dbprintf("got map request for %x\n", (unsigned)window);
L("got map request for %x\n", (unsigned)window);
#endif
if ((wwin = wWindowFor(window))) {
if (wwin->flags.shaded) {
wUnshadeWindow(wwin);
@@ -540,9 +542,8 @@ handleDestroyNotify(XEvent *event)
Window window = event->xdestroywindow.window;
#ifdef DEBUG
dbputs("got destroy notify");
#endif
L("got destroy notify");
#endif
wwin = wWindowFor(window);
if (wwin) {
wUnmanageWindow(wwin, False, True);
@@ -576,10 +577,9 @@ handleExpose(XEvent *event)
WObjDescriptor *desc;
XEvent ev;
#ifdef DEBUG
dbputs("got expose");
#ifdef DEBUG
L("got expose");
#endif
while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev));
if (XFindContext(dpy, event->xexpose.window, wWinContext,
@@ -599,11 +599,9 @@ handleButtonPress(XEvent *event)
{
WObjDescriptor *desc;
WScreen *scr;
#ifdef DEBUG
dbputs("got button press");
#ifdef DEBUG
L("got button press");
#endif
scr = wScreenForRootWindow(event->xbutton.root);
#ifdef BALLOON_TEXT
@@ -706,11 +704,9 @@ static void
handleMapNotify(XEvent *event)
{
WWindow *wwin;
#ifdef DEBUG
dbputs("got map");
L("got map");
#endif
wwin = wWindowFor(event->xmap.event);
if (wwin && wwin->client_win == event->xmap.event) {
if (wwin->flags.miniaturized) {
@@ -731,11 +727,9 @@ handleUnmapNotify(XEvent *event)
WWindow *wwin;
XEvent ev;
Bool withdraw = False;
#ifdef DEBUG
dbputs("got unmap");
L("got unmap");
#endif
/* only process windows with StructureNotify selected
* (ignore SubstructureNotify) */
wwin = wWindowFor(event->xunmap.window);
@@ -785,9 +779,8 @@ static void
handleConfigureRequest(XEvent *event)
{
WWindow *wwin;
#ifdef DEBUG
dbputs("got configure request");
L("got configure request");
#endif
if (!(wwin=wWindowFor(event->xconfigurerequest.window))) {
/*
@@ -809,9 +802,8 @@ handlePropertyNotify(XEvent *event)
int ji;
unsigned int ju;
WScreen *scr;
#ifdef DEBUG
dbputs("got property notify");
L("got property notify");
#endif
if ((wwin=wWindowFor(event->xproperty.window))) {
if (!XGetGeometry(dpy, wwin->client_win, &jr, &ji, &ji,
@@ -839,9 +831,8 @@ handleClientMessage(XEvent *event)
{
WWindow *wwin;
WObjDescriptor *desc;
#ifdef DEBUG
dbputs("got client message");
L("got client message");
#endif
/* handle transition from Normal to Iconic state */
if (event->xclient.message_type == _XA_WM_CHANGE_STATE
@@ -975,12 +966,9 @@ handleEnterNotify(XEvent *event)
WObjDescriptor *desc = NULL;
XEvent ev;
WScreen *scr = wScreenForRootWindow(event->xcrossing.root);
#ifdef DEBUG
dbputs("got enter notify");
L("got enter notify");
#endif
if (XCheckTypedWindowEvent(dpy, event->xcrossing.window, LeaveNotify,
&ev)) {
/* already left the window... */
@@ -998,11 +986,9 @@ handleEnterNotify(XEvent *event)
event->xcrossing.x_root >= (scr->scr_width - 2) ||
event->xcrossing.y_root <= 1 ||
event->xcrossing.y_root >= (scr->scr_height - 2)) {
#ifdef DEBUG
dbputs("pointer at screen edge in EnterNotify event, fear");
L("pointer at screen edge in EnterNotify event, fear");
#endif
menu = wMenuUnderPointer(scr);
if (menu!=NULL) {
wMenuScroll(menu, event);
@@ -1128,11 +1114,9 @@ handleShapeNotify(XEvent *event)
XShapeEvent *shev = (XShapeEvent*)event;
WWindow *wwin;
XEvent ev;
#ifdef DEBUG
dbputs("got shape notify");
#ifdef DEBGU
L("got shape notify");
#endif
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
XShapeEvent *sev = (XShapeEvent*)&ev;
@@ -1362,7 +1346,6 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
if (!wwin)
return;
/* dbputs("IN");*/
keymap = XGetModifierMapping(dpy);
@@ -1398,7 +1381,6 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
WMHandleEvent(&ev);
continue;
}
/*dbputs("EV");*/
/* ignore CapsLock */
modifiers = ev.xkey.state & ValidModMask;
@@ -1439,7 +1421,6 @@ doWindozeCycle(WWindow *wwin, XEvent *event, Bool next)
}
}
}
/*dbputs("OUT");*/
XFree(keymap);
XUngrabKeyboard(dpy, CurrentTime);
@@ -1834,11 +1815,9 @@ handleMotionNotify(XEvent *event)
event->xmotion.x_root >= (scr->scr_width - 2) ||
event->xmotion.y_root <= 1 ||
event->xmotion.y_root >= (scr->scr_height - 2)) {
#ifdef DEBUG
dbputs("pointer at screen edge");
L("pointer at screen edge");
#endif
menu = wMenuUnderPointer(scr);
if (menu!=NULL)
wMenuScroll(menu, event);

View File

@@ -102,6 +102,8 @@ char *ExpandOptions(WScreen *scr, char *cmdline);
void ExecuteShellCommand(WScreen *scr, char *command);
void StartLogShell(WScreen *scr);
Bool IsDoubleClick(WScreen *scr, XEvent *event);
WWindow *NextFocusWindow(WScreen *scr);
@@ -160,10 +162,4 @@ Bool wGetIconName(Display *dpy, Window win, char **iconname);
/* debugging stuff */
void dbprintf(char *, ...);
void dbputs(char *);
#endif

View File

@@ -151,6 +151,9 @@ static int ArgCount;
extern void EventLoop();
extern void StartUp();
/* stdi/o for log shell */
static int LogStdIn = -1, LogStdOut = -1, LogStdErr = -1;
void
Exit(int status)
@@ -224,6 +227,159 @@ SetupEnvironment(WScreen *scr)
}
typedef struct {
WScreen *scr;
char *command;
} _tuple;
static void
shellCommandHandler(pid_t pid, unsigned char status, _tuple *data)
{
if (status == 127) {
char *buffer;
buffer = wstrappend(_("Could not execute command: "), data->command);
wMessageDialog(data->scr, _("Error"), buffer, _("OK"), NULL, NULL);
free(buffer);
} else if (status != 127) {
/*
printf("%s: %i\n", data->command, status);
*/
}
free(data->command);
free(data);
}
void
ExecuteShellCommand(WScreen *scr, char *command)
{
static char *shell = NULL;
pid_t pid;
/*
* This have a problem: if the shell is tcsh (not sure about others)
* and ~/.tcshrc have /bin/stty erase ^H somewhere on it, the shell
* will block and the command will not be executed.
if (!shell) {
shell = getenv("SHELL");
if (!shell)
shell = "/bin/sh";
}
*/
shell = "/bin/sh";
pid = fork();
if (pid==0) {
SetupEnvironment(scr);
#ifdef HAVE_SETPGID
setpgid(0, 0);
#endif
execl(shell, shell, "-c", command, NULL);
wsyserror("could not execute %s -c %s", shell, command);
Exit(-1);
} else if (pid < 0) {
wsyserror("cannot fork a new process");
} else {
_tuple *data = wmalloc(sizeof(_tuple));
data->scr = scr;
data->command = wstrdup(command);
wAddDeathHandler(pid, (WDeathHandler*)shellCommandHandler, data);
}
}
/*
*---------------------------------------------------------------------------
* StartLogShell
* Start a shell that will receive all stdin and stdout from processes
* forked by wmaker.
*---------------------------------------------------------------------------
*/
void
StartLogShell(WScreen *scr)
{
int in_fd[2];
int out_fd[2];
int err_fd[2];
pid_t pid;
SetupEnvironment(scr);
if (pipe(in_fd) < 0) {
wsyserror("could not create pipe for log shell\n");
return;
}
if (pipe(out_fd) < 0) {
wsyserror("could not create pipe for log shell\n");
close(in_fd[0]);
close(in_fd[1]);
return;
}
if (pipe(err_fd) < 0) {
wsyserror("could not create pipe for log shell\n");
close(out_fd[0]);
close(out_fd[1]);
close(in_fd[0]);
close(in_fd[1]);
return;
}
pid = fork();
if (pid < 0) {
wsyserror("could not fork a new process for log shell\n");
return;
} else if (pid == 0) {
close(in_fd[0]);
close(out_fd[1]);
close(err_fd[1]);
close(0);
close(1);
close(2);
if (dup2(in_fd[1], 0) < 0) {
wsyserror("could not redirect stdin for log shell\n");
exit(1);
}
if (dup2(out_fd[1], 1) < 0) {
wsyserror("could not redirect stdout for log shell\n");
exit(1);
}
if (dup2(err_fd[1], 2) < 0) {
wsyserror("could not redirect stderr for log shell\n");
exit(1);
}
close(in_fd[1]);
close(out_fd[1]);
close(err_fd[1]);
execl("/bin/sh", "/bin/sh", "-c", wPreferences.logger_shell, NULL);
wsyserror("could not execute %s\n", wPreferences.logger_shell);
exit(1);
} else {
close(in_fd[1]);
close(out_fd[0]);
close(err_fd[0]);
LogStdIn = in_fd[1];
LogStdOut = out_fd[0];
LogStdErr = err_fd[0];
}
}
/*
*---------------------------------------------------------------------
* wAbort--

View File

@@ -31,6 +31,7 @@
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <nana.h>
#include "WindowMaker.h"
#include "wcore.h"
@@ -284,23 +285,13 @@ wMenuInsertCallback(WMenu *menu, int index, char *text,
{
WMenuEntry *entry;
#ifdef DEBUG
if (!menu) {
dbprintf("Passed NULL as menu parameter to wMenuAddCallback() \n");
return NULL;
}
#endif
assert(menu->flags.brother==0);
menu->flags.realized = 0;
menu->brother->flags.realized = 0;
/* reallocate array if it's too small */
if (menu->entry_no >= menu->alloced_entries) {
void *tmp;
#ifdef DEBUG
dbputs("doing wrealloc()");
#endif
tmp = wrealloc(menu->entries,
sizeof(WMenuEntry)*(menu->alloced_entries+5));
if (tmp==NULL) {
@@ -1777,10 +1768,6 @@ wMenuScroll(WMenu *menu, XEvent *event)
int old_frame_x = omenu->frame_x;
int old_frame_y = omenu->frame_y;
XEvent ev;
#ifdef DEBUG
dbputs("Entering menu Scroll");
#endif
if (omenu->jump_back)
WMDeleteTimerWithClientData(omenu->jump_back);
@@ -1887,11 +1874,6 @@ wMenuScroll(WMenu *menu, XEvent *event)
else delayer = omenu->jump_back;
WMAddTimerHandler(MENU_JUMP_BACK_DELAY,(WMCallback*)_leaving, delayer);
}
#ifdef DEBUG
dbputs("Leaving menu Scroll");
#endif
}
@@ -2313,10 +2295,6 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
int i, lower;
Bool started;
#ifdef DEBUG
dbprintf("Moving menu\n");
#endif
/* can't touch the menu copy */
if (menu->flags.brother)
return;
@@ -2400,9 +2378,6 @@ menuTitleMouseDown(WCoreWindow *sender, void *data, XEvent *event)
case ButtonRelease:
if (ev.xbutton.button != event->xbutton.button)
break;
#ifdef DEBUG
dbprintf("End menu move\n");
#endif
XUngrabPointer(dpy, CurrentTime);
return;

View File

@@ -1394,97 +1394,3 @@ SendHelperMessage(WScreen *scr, char type, int workspace, char *msg)
}
free(buffer);
}
typedef struct {
WScreen *scr;
char *command;
} _tuple;
static void
shellCommandHandler(pid_t pid, unsigned char status, _tuple *data)
{
if (status == 127) {
char *buffer;
buffer = wstrappend(_("Could not execute command: "), data->command);
wMessageDialog(data->scr, _("Error"), buffer, _("OK"), NULL, NULL);
free(buffer);
} else if (status != 127) {
/*
printf("%s: %i\n", data->command, status);
*/
}
free(data->command);
free(data);
}
void
ExecuteShellCommand(WScreen *scr, char *command)
{
static char *shell = NULL;
pid_t pid;
/*
* This have a problem: if the shell is tcsh (not sure about others)
* and ~/.tcshrc have /bin/stty erase ^H somewhere on it, the shell
* will block and the command will not be executed.
if (!shell) {
shell = getenv("SHELL");
if (!shell)
shell = "/bin/sh";
}
*/
shell = "/bin/sh";
pid = fork();
if (pid==0) {
SetupEnvironment(scr);
#ifdef HAVE_SETPGID
setpgid(0, 0);
#endif
execl(shell, shell, "-c", command, NULL);
wsyserror("could not execute %s -c %s", shell, command);
Exit(-1);
} else if (pid < 0) {
wsyserror("cannot fork a new process");
} else {
_tuple *data = wmalloc(sizeof(_tuple));
data->scr = scr;
data->command = wstrdup(command);
wAddDeathHandler(pid, (WDeathHandler*)shellCommandHandler, data);
}
}
void dbprintf(char *format, ...)
{
va_list args;
va_start(args, format);
vprintf(format, args);
fflush(stdout);
va_end(args);
}
void dbputs(char *text)
{
puts(text);
fflush(stdout);
}

46
src/nana.h Normal file
View File

@@ -0,0 +1,46 @@
/*
* nana.h - the include that includes everything else.
*
* Copyright (c) 1997 Phil Maker
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* Id: nana.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _nana_h_
#define _nana_h_ 1
#include <I.h>
#include <DI.h>
#include <L.h>
#include <DL.h>
#include <Q.h>
#include <GDB.h>
#endif /* _nana_h_ */

View File

@@ -25,7 +25,6 @@
#ifndef LITE
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

View File

@@ -509,7 +509,8 @@ wSessionRestoreState(WScreen *scr)
btn = dock->icon_array[j];
if (btn && SAME(instance, btn->wm_instance) &&
SAME(class, btn->wm_class) &&
SAME(command, btn->command)) {
SAME(command, btn->command) &&
!btn->launching) {
found = 1;
break;
}