123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- /*
- * structs.h
- * Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of the nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
- * OWNER 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.
- */
- #ifndef STRUCTS_H
- #define STRUCTS_H
- #include "wmfs.h"
- #define NBUTTON 8
- #define MAXTAG 36
- #define NUM_OF_LAYOUT 10
- /* Clients flags definition */
- #define FreeFlag (1 << 1)
- #define MaxFlag (1 << 2)
- #define TileFlag (1 << 3)
- #define HideFlag (1 << 4)
- #define LMaxFlag (1 << 5)
- #define UnmapFlag (1 << 6)
- #define HintFlag (1 << 7)
- #define FSSFlag (1 << 8)
- #define AboveFlag (1 << 9)
- /* XEMBED messages */
- #define XEMBED_MAPPED (1 << 0)
- #define XEMBED_EMBEDDED_NOTIFY 0
- #define XEMBED_WINDOW_ACTIVATE 1
- #define XEMBED_WINDOW_DEACTIVATE 2
- #define XEMBED_REQUEST_FOCUS 3
- #define XEMBED_FOCUS_IN 4
- #define XEMBED_FOCUS_OUT 5
- #define XEMBED_FOCUS_NEXT 6
- #define XEMBED_FOCUS_PREV 7
- /* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */
- #define XEMBED_MODALITY_ON 10
- #define XEMBED_MODALITY_OFF 11
- #define XEMBED_REGISTER_ACCELERATOR 12
- #define XEMBED_UNREGISTER_ACCELERATOR 13
- #define XEMBED_ACTIVATE_ACCELERATOR 14
- /* Details for XEMBED_FOCUS_IN: */
- #define XEMBED_FOCUS_CURRENT 0
- #define XEMBED_FOCUS_FIRST 1
- #define XEMBED_FOCUS_LAST 2
- /* Typedef */
- typedef const char* uicb_t;
- typedef unsigned int uint;
- typedef unsigned long ulong;
- typedef unsigned short ushort;
- typedef unsigned char uchar;
- /* Enum */
- enum { CurNormal, CurResize, CurRightResize, CurLeftResize, CurMove, CurLast };
- /* Infobar position */
- enum { IB_Hide = 0, IB_Bottom = 1, IB_Top = 2 };
- typedef enum { Right, Left, Top, Bottom, Center, PositionLast } Position;
- /* Ewmh hints list */
- enum
- {
- net_supported,
- net_wm_name,
- net_client_list,
- net_frame_extents,
- net_number_of_desktops,
- net_current_desktop,
- net_desktop_names,
- net_desktop_geometry,
- net_workarea,
- net_active_window,
- net_close_window,
- net_wm_icon_name,
- net_wm_window_type,
- net_wm_pid,
- net_showing_desktop,
- net_supporting_wm_check,
- net_wm_window_type_normal,
- net_wm_window_type_dock,
- net_wm_window_type_splash,
- net_wm_window_type_dialog,
- net_wm_desktop,
- net_wm_icon,
- net_wm_state,
- net_wm_state_fullscreen,
- net_wm_state_demands_attention,
- utf8_string,
- /* WMFS HINTS */
- wmfs_running,
- wmfs_update_hints,
- wmfs_update_status,
- wmfs_current_tag,
- wmfs_current_screen,
- wmfs_current_layout,
- wmfs_tag_list,
- wmfs_mwfact,
- wmfs_nmaster,
- wmfs_set_screen,
- wmfs_screen_count,
- wmfs_function,
- wmfs_cmd,
- wmfs_statustext,
- net_last
- };
- /*
- * BarWindow Structure
- * (titlebar, infobar..)
- */
- typedef struct
- {
- Window win;
- Drawable dr;
- struct
- {
- /* Border Window */
- Window left, right, top, bottom;
- /* Border color */
- uint dark, light;
- } border;
- uint bg;
- char *fg;
- uint stipple_color;
- XRectangle geo;
- Bool mapped, stipple, bord;
- } BarWindow;
- /* Client Structure. */
- typedef struct Client Client;
- struct Client
- {
- /* Client title */
- char *title;
- /* Tag num */
- uint tag;
- /* Screen */
- int screen;
- /* Layer */
- int layer;
- /* Window attribute */
- XRectangle geo;
- XRectangle tmp_geo;
- XRectangle frame_geo;
- /* Old window attribute */
- XRectangle ogeo;
- /* For resizehint usage */
- int basew, baseh, incw, inch;
- int maxw, maxh, minw, minh;
- int minax, maxax, minay, maxay;
- /* Client composant {{{ */
- Window win;
- Window *button;
- int button_last_x;
- BarWindow *titlebar;
- Window frame, resize[2];
- /* Border */
- Window right, left, top, bottom;
- /* }}} */
- struct
- {
- uint frame;
- char *fg;
- uint resizecorner;
- } colors;
- /* Client Information by flags */
- uint flags;
- /* Struct in chains */
- Client *next;
- Client *prev;
- };
- /* Keybind Structure */
- typedef struct
- {
- uint mod;
- KeySym keysym;
- void (*func)(uicb_t);
- uicb_t cmd;
- } Key;
- /* Mouse Binding Struct */
- typedef struct
- {
- int tag;
- int screen;
- uint button;
- void (*func)(uicb_t);
- uicb_t cmd;
- } MouseBinding;
- /* InfoBar Struct */
- typedef struct
- {
- BarWindow *bar;
- BarWindow *layout_button;
- BarWindow *tags[MAXTAG];
- XRectangle geo;
- int position;
- char *statustext;
- } InfoBar;
- /* Layout Structure */
- typedef struct
- {
- char *symbol;
- void (*func)(int screen);
- } Layout;
- /* Tag Structure */
- typedef struct
- {
- char *name;
- char **clients;
- int nclients;
- int layers;
- float mwfact;
- int nmaster;
- Bool resizehint;
- Bool request_update;
- Bool abovefc;
- int barpos;
- Layout layout;
- } Tag;
- /* Menu Item Struct */
- typedef struct
- {
- char *name;
- void (*func)(uicb_t);
- uicb_t cmd;
- } MenuItem;
- /* Menu Struct */
- typedef struct
- {
- /* Name of the menu for call
- * it in the conf (function = "menu"
- * menu = "<name>").
- */
- char *name;
- /* Placement */
- Bool place_at_mouse;
- int x, y;
- /* Color */
- struct
- {
- struct { uint bg; char *fg; } focus;
- struct { uint bg; char *fg; } normal;
- } colors;
- /* Number of item */
- int nitem, focus_item;
- /* Item */
- MenuItem *item;
- } Menu;
- /* Launcher struct */
- typedef struct
- {
- char *name;
- char *prompt;
- char *command;
- } Launcher;
- /* Button struct */
- typedef struct
- {
- MouseBinding *mouse;
- XSegment *linecoord;
- int nlines;
- int nmouse;
- } Button;
- /* Alias struct */
- typedef struct
- {
- char *name;
- char *content;
- } Alias;
- /* Configuration structure */
- typedef struct
- {
- /* Configuration file path */
- char confpath[512];
- /* Misc option */
- char *font;
- Bool raisefocus;
- Bool raiseswitch;
- Bool focus_fmouse;
- uint pad;
- int status_timing;
- struct
- {
- /*
- * Only the colors will be use for text
- * are 'char*' (for xprint -> XftColorAllocName)
- */
- uint bar;
- char *text;
- char *tagselfg;
- uint tagselbg;
- uint tag_occupied_bg;
- uint tagbord;
- char *layout_fg;
- uint layout_bg;
- } colors;
- struct
- {
- int height;
- MouseBinding *mouse;
- int nmouse;
- } bars;
- struct
- {
- char *background_command;
- MouseBinding *mouse;
- int nmouse;
- } root;
- struct
- {
- Bool set_new_win_master;
- Bool place_at_mouse;
- Bool border_shadow;
- int borderheight;
- uint bordernormal;
- uint borderfocus;
- uint resizecorner_normal;
- uint resizecorner_focus;
- uint mod;
- MouseBinding *mouse;
- int nmouse;
- } client;
- struct
- {
- int height;
- char *fg_normal;
- char *fg_focus;
- struct
- {
- Bool active;
- struct { uint normal, focus; } colors;
- } stipple;
- MouseBinding *mouse;
- int nmouse;
- Button *button;
- int nbutton;
- } titlebar;
- struct
- {
- Bool bar;
- Bool tag;
- Bool layout;
- } border;
- Alias alias[256];
- Layout layout[NUM_OF_LAYOUT];
- Menu *menu;
- Launcher *launcher;
- int *ntag;
- Bool tag_round;
- Bool layout_system; /* Switch: False, Menu: True. */
- /* Number of... */
- int nkeybind;
- int nlayout;
- int nmenu;
- int nlauncher;
- } Conf;
- /* Config.c struct */
- typedef struct
- {
- char *name;
- void *func;
- } func_name_list_t;
- typedef struct
- {
- char *name;
- KeySym keysym;
- } key_name_list_t;
- typedef struct
- {
- char *name;
- uint button;
- } name_to_uint_t;
- typedef struct
- {
- char *cmd;
- char *uicb;
- } vicmd_to_uicb;
- #endif /* STRUCTS_H */
|