Re: A Proposal For Color-Reactiveness AND extened hints...



Okay.. so this isn't just a proposal.. its cold hard working code.. but
quite able to be expanded and modified. This code will be in E 0.14
when it is released... I haven't seen or heard of any concrete code
form ICEWM for the extended hints. I checked the webpage and the
proposal posted to the list wasn't evry explicit, and even stated it
needed improvement. I went throught and tried to do this and have
cerated what I believe to be a firm set of extended hints a client can
use. Any input is always appreciated and the blow code is GPL so feel
free comment add any improvements as comments etc so before this goes
"production" its suitable fore use.

#include "E.h"

#define EXTENDED_HINT_STICKY            (1<<0)
#define EXTENDED_HINT_ONTOP             (1<<1)
#define EXTENDED_HINT_ONBOTTOM          (1<<2)
#define EXTENDED_HINT_NEVER_USE_AREA    (1<<3)
#define EXTENDED_HINT_DESKTOP           (1<<4)
#define EXTENDED_HINT_MASKS             (1<<5)
#define EXTENDED_HINT_LAYER             (1<<6)
#define EXTENDED_HINT_STATE             (1<<7)

#define EXTENDER_HINT_LAYER_DESKTOP     0
#define EXTENDER_HINT_LAYER_BELOW       1
#define EXTENDER_HINT_LAYER_NORMAL      2
#define EXTENDER_HINT_LAYER_ONTOP       4
#define EXTENDER_HINT_LAYER_DOCK        6

#define EXTENDER_HINT_STATE_NORMAL     0
#define EXTENDER_HINT_STATE_MAXIMIZED  1
#define EXTENDER_HINT_STATE_SHADED     2

typedef struct _extended_hints
  {
     /* flags whihc members are used - some flags hve no members and are */
     /* states on their own */
     CARD32              flags;
     /* a sinmple desktop number for those who dont want to exist on */
     /* multiple desktops */
     CARD32              desktop;
     /* a desktop mask 1 exists there, 0 doesnt. there is room for */
     /* 128 desktops here :) LSB of desktop_mask0is desktop 0, MSB is 32 */
     /* LSB desktop_mask1 is 33 etc. */
     CARD32              desktop_mask0;
     CARD32              desktop_mask1;
     CARD32              desktop_mask2;
     CARD32              desktop_mask3;
     /* the layer the window exists in.. mroe fine-grained control than the */
     /* ontop and onbottom flags */
     CARD32              layer;
     /* extra states for a window to be in */
     CARD32              state;
     /* possible icons to use - everal sizes 8x8, 12x12, 16x16 etc. up to */
     /* 128x128 (the number at the end is the XxX size) If the mask ID is */
     /* 0 then there is no mask, i the pixmap Id is 0 there is no pixmap */
     /* defined for that size */
     Pixmap              pixmap8, mask8;
     Pixmap              pixmap12, mask12;
     Pixmap              pixmap16, mask16;
     Pixmap              pixmap20, mask20;
     Pixmap              pixmap24, mask24;
     Pixmap              pixmap32, mask32;
     Pixmap              pixmap40, mask40;
     Pixmap              pixmap48, mask48;
     Pixmap              pixmap64, mask64;
     Pixmap              pixmap96, mask96;
     Pixmap              pixmap128, mask128;
  }
ExtendedHints;

#define EXTENDER_HINT_APP_STATE_NONE                 0
#define EXTENDER_HINT_APP_STATE_ACTIVE1              1
#define EXTENDER_HINT_APP_STATE_ACTIVE2              2
#define EXTENDER_HINT_APP_STATE_ERROR1               3
#define EXTENDER_HINT_APP_STATE_ERROR2               4
#define EXTENDER_HINT_APP_STATE_FATAL_ERROR1         5
#define EXTENDER_HINT_APP_STATE_FATAL_ERROR2         6
#define EXTENDER_HINT_APP_STATE_IDLE1                7
#define EXTENDER_HINT_APP_STATE_IDLE2                8
#define EXTENDER_HINT_APP_STATE_WAITING1             9
#define EXTENDER_HINT_APP_STATE_WAITING2             10
#define EXTENDER_HINT_APP_STATE_WORKING1             11
#define EXTENDER_HINT_APP_STATE_WORKING2             12
#define EXTENDER_HINT_APP_STATE_NEED_USER_INPUT1     13
#define EXTENDER_HINT_APP_STATE_NEED_USER_INPUT2     14
#define EXTENDER_HINT_APP_STATE_STRUGGLING1          15
#define EXTENDER_HINT_APP_STATE_STRUGGLING2          16
#define EXTENDER_HINT_APP_STATE_DISK_TRAFFIC1        17
#define EXTENDER_HINT_APP_STATE_DISK_TRAFFIC2        18
#define EXTENDER_HINT_APP_STATE_NETWORK_TRAFFIC1     19
#define EXTENDER_HINT_APP_STATE_NETWORK_TRAFFIC2     20
#define EXTENDER_HINT_APP_STATE_OVERLOADED1          21
#define EXTENDER_HINT_APP_STATE_OVERLOADED2          22
#define EXTENDER_HINT_APP_STATE_PERCENT000_1         23
#define EXTENDER_HINT_APP_STATE_PERCENT000_2         24
#define EXTENDER_HINT_APP_STATE_PERCENT010_1         25
#define EXTENDER_HINT_APP_STATE_PERCENT010_2         26
#define EXTENDER_HINT_APP_STATE_PERCENT020_1         27
#define EXTENDER_HINT_APP_STATE_PERCENT020_2         28
#define EXTENDER_HINT_APP_STATE_PERCENT030_1         29
#define EXTENDER_HINT_APP_STATE_PERCENT030_2         30
#define EXTENDER_HINT_APP_STATE_PERCENT040_1         31
#define EXTENDER_HINT_APP_STATE_PERCENT040_2         32
#define EXTENDER_HINT_APP_STATE_PERCENT050_1         33
#define EXTENDER_HINT_APP_STATE_PERCENT050_2         34
#define EXTENDER_HINT_APP_STATE_PERCENT060_1         35
#define EXTENDER_HINT_APP_STATE_PERCENT060_2         36
#define EXTENDER_HINT_APP_STATE_PERCENT070_1         37
#define EXTENDER_HINT_APP_STATE_PERCENT070_2         38
#define EXTENDER_HINT_APP_STATE_PERCENT080_1         39
#define EXTENDER_HINT_APP_STATE_PERCENT080_2         40
#define EXTENDER_HINT_APP_STATE_PERCENT090_1         41
#define EXTENDER_HINT_APP_STATE_PERCENT090_2         42
#define EXTENDER_HINT_APP_STATE_PERCENT100_1         43
#define EXTENDER_HINT_APP_STATE_PERCENT100_2         44

void
GNOME_GetHints(EWin * ewin)
{
   Atom                a1, a3;
   unsigned long       lnum, ldummy;
   int                 dummy;
   ExtendedHints      *eh;
   unsigned int       *state;

   a1 = XInternAtom(disp, "WM_EXTENDED_HINTS", False);
   eh = NULL;
   XGetWindowProperty(disp, ewin->client.win, a1, 0, sizeof(ExtendedHints) /
                      sizeof(unsigned long), False, a1, &a3, &dummy, &lnum,
                      &ldummy,            (unsigned char **)&eh);

   if (eh)
     {
        if (eh->flags & EXTENDED_HINT_STICKY)
           ewin->sticky = 1;
        if (eh->flags & EXTENDED_HINT_ONTOP)
           ewin->ontop = 1;
        if (eh->flags & EXTENDED_HINT_ONBOTTOM)
           ewin->onbottom = 1;
        if (eh->flags & EXTENDED_HINT_NEVER_USE_AREA)
           ewin->never_use_area = 1;
        if (eh->flags & EXTENDED_HINT_DESKTOP)
           ewin->desktop = eh->desktop & 0x1f;
        XFree(eh);
     }

   a1 = XInternAtom(disp, "WM_EXTENDED_APP_STATE", False);
   state = NULL;
   XGetWindowProperty(disp, ewin->client.win, a1, 0, 1,
                      False, XA_CARDINAL, &a3, &dummy, &lnum,
                      &ldummy, &state);
   if (state)
     {
        app_state = state;
        XFree(state);
     }
}

-- 
--------------- Codito, ergo sum - "I code, therefore I am" --------------------
raster@rasterman.com       /\___ /\ ___/||\___ ____/|/\___  raster@redhat.com
Carsten Haitzler           | _ //__\\ __||_ __\\ ___|| _ /  Red Hat Advanced
218/21 Conner Drive        || // __ \\_ \ | |   \ _/_|| /   Development Labs
Chapel Hill NC 27514 USA   ||\\\/  \//__/ |_|   /___/||\\   919 547 0012 ext 282
+1 (919) 929 9443, 801 4392   For pure Enlightenmenthttp://www.rasterman.com/ 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]