[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: fixing crappy X headers
From:       Lubos Lunak <l.lunak () sh ! cvut ! cz>
Date:       2001-05-19 12:40:11
[Download RAW message or body]

Dne so 19. květen 2001 14:21 Michael Matz napsal(a):
> Hi,
>
> On Sat, 19 May 2001, Lubos Lunak wrote:
> >  Ok, looks probably a bit complicated, but it simply does #define None ->
> > X::None . To use it, just simply include the file after including X11
> > headers or before the place where the problem occurs, it may be included
> > repeatedly and the compile time increase is unnoticeable.
> >  I've already modified my local kdelibs ( it was only a few changes like
> > XKeyPress -> X::KeyPress etc. ) and I'm now compiling kdebase. I'll
> > commit after the freeze is over. The macros that get converted are :
> > None, Bool, Unsorted, KeyPress, KeyRelease, Above, Below, FocusIn,
> > FocusOut . Did I miss some important ?
>
> You of course are aware, that Bool is not const int, but a type, sometimes

 If Bool is not #defined , it will be skipped, that's why there is #ifdef 
Bool , if it's #defined, X::Bool is typedef'd to Bool ( typedef Bool XBool; ).

> #define'ed, sometimes really typedef'ed?  Also, that None usually is 0L,
> which is not necessarily an int and Key{Press,Release} are char's?  I just

 None is XID , and Key{Press,Release} are event names, so they are the same 
like e.g. FocusIn.

> want to make sure, that such things are remembered when playing tricks.

 Well, maybe I forgot a bit, I'll at least check also here on school's 
Solaris machines. But I think all the ones I listed are ok as ints ( except 
for Bool and None ). If you know a reason why this is bad, yell.

>
>
> Ciao,
> Michael.

 Lubos Lunak
--
 l.lunak@email.cz ; l.lunak@kde.org
 http://dforce.sh.cvut.cz/~seli

["fixx11h.h" (text/x-c++)]

//#ifdef    don't do this, this file is supposed to be included
//#define   multiple times

namespace X
{

// --->
#ifdef Unsorted
#ifndef FIXX11H_Unsorted
#define FIXX11H_Unsorted
const int XUnsorted = Unsorted;
#undef Unsorted
const int Unsorted = XUnsorted;
#endif
#undef Unsorted
#endif
// <---

// --->
#ifdef None
#ifndef FIXX11H_None
#define FIXX11H_None
const XID XNone = None;
#undef None
const XID None = XNone;
#endif
#undef None
#endif
// <---

// --->
#ifdef Bool
#ifndef FIXX11H_Bool
#define FIXX11H_Bool
typedef Bool XBool;
#undef Bool
typedef XBool Bool;
#endif
#undef Bool
#endif
// <---

#ifdef KeyPress
#ifndef FIXX11H_KeyPress
#define FIXX11H_KeyPress
const int XKeyPress = KeyPress;
#undef KeyPress
const int KeyPress = XKeyPress;
#endif
#undef KeyPress
#endif

#ifdef KeyRelease
#ifndef FIXX11H_KeyRelease
#define FIXX11H_KeyRelease
const int XKeyRelease = KeyRelease;
#undef KeyRelease
const int KeyRelease = XKeyRelease;
#endif
#undef KeyRelease
#endif

#ifdef Above
#ifndef FIXX11H_Above
#define FIXX11H_Above
const int XAbove = Above;
#undef Above
const int Above = XAbove;
#endif
#undef Above
#endif

#ifdef Below
#ifndef FIXX11H_Below
#define FIXX11H_Below
const int XBelow = Below;
#undef Below
const int Below = XBelow;
#endif
#undef Below
#endif

#ifdef FocusIn
#ifndef FIXX11H_FocusIn
#define FIXX11H_FocusIn
const int XFocusIn = FocusIn;
#undef FocusIn
const int FocusIn = XFocusIn;
#endif
#undef FocusIn
#endif

#ifdef FocusOut
#ifndef FIXX11H_FocusOut
#define FIXX11H_FocusOut
const int XFocusOut = FocusOut;
#undef FocusOut
const int FocusOut = XFocusOut;
#endif
#undef FocusOut
#endif

};


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic