wmii/cmd/wm/wm.h

207 lines
4.6 KiB
C
Raw Normal View History

2005-11-18 18:54:58 +03:00
/*
2006-01-20 17:20:24 +03:00
* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
2005-11-18 18:54:58 +03:00
* See LICENSE file for license details.
*/
#include <stdio.h>
#include <X11/Xlib.h>
2005-11-18 18:54:58 +03:00
#include <X11/Xutil.h>
#include "wmii.h"
2005-12-27 23:13:50 +03:00
/* array indexes of EWMH window properties */
/* TODO: set / react */
enum {
NET_NUMBER_OF_DESKTOPS, /* ✓ */
NET_CURRENT_DESKTOP, /* ✓ ✓ */
NET_WM_DESKTOP /* ✗ ✗ */
};
#define NET_ATOM_COUNT 3
2005-11-18 18:54:58 +03:00
#define PROTO_DEL 1
2005-12-07 04:20:36 +03:00
#define BORDER_WIDTH 3
#define GAP 5
2005-11-18 18:54:58 +03:00
#define ROOT_MASK SubstructureRedirectMask
#define CLIENT_MASK (StructureNotifyMask | PropertyChangeMask)
2005-11-18 18:54:58 +03:00
typedef struct Column Column;
2005-11-18 18:54:58 +03:00
typedef struct Page Page;
typedef struct Client Client;
struct Column {
2006-01-26 17:24:34 +03:00
Client **client;
size_t clientsz;
size_t sel;
2006-01-31 15:25:23 +03:00
size_t nclient;
2006-01-26 17:24:34 +03:00
XRectangle rect;
2005-11-18 18:54:58 +03:00
};
struct Page {
2006-01-31 15:25:23 +03:00
Client **floatc;
Column **col;
size_t floatcsz;
size_t colsz;
size_t sel_float;
2006-01-31 15:25:23 +03:00
size_t sel_col;
size_t nfloat;
size_t ncol;
2006-01-26 17:24:34 +03:00
Bool is_column;
XRectangle rect_column;
2005-11-18 18:54:58 +03:00
};
struct Client {
char name[256];
2005-12-21 18:18:11 +03:00
int proto;
unsigned int border;
unsigned int ignore_unmap;
Bool handle_inc;
2005-12-21 18:18:11 +03:00
Bool destroyed;
Bool maximized;
2006-01-26 14:56:28 +03:00
Bool attached;
2006-01-26 17:24:34 +03:00
Column *column;
2005-12-21 18:18:11 +03:00
Window win;
Window trans;
XRectangle rect;
XSizeHints size;
2006-01-25 21:41:12 +03:00
Page *page;
struct Frame {
Window win;
XRectangle rect;
XRectangle revert;
GC gc;
Cursor cursor;
Bool title;
2006-01-31 19:52:14 +03:00
unsigned int border;
} frame;
2005-11-18 18:54:58 +03:00
};
/* global variables */
2006-01-26 17:24:34 +03:00
Page **page;
2006-01-31 15:25:23 +03:00
size_t npage;
2006-01-26 17:24:34 +03:00
size_t pagesz;
size_t sel_page;
2006-01-26 14:39:20 +03:00
Page **aqueue;
size_t aqueuesz;
Client **detached;
size_t detachedsz;
2006-01-26 17:24:34 +03:00
Client **client;
size_t clientsz;
2005-12-05 01:45:59 +03:00
Display *dpy;
IXPServer *ixps;
int screen;
2005-12-05 01:45:59 +03:00
Window root;
Window transient; /* pager / attach */
2005-12-05 01:45:59 +03:00
XRectangle rect;
XFontStruct *xfont;
XColor color_xor;
GC gc_xor;
GC gc_transient;
2006-01-31 01:48:41 +03:00
IXPServer *srv;
2005-11-18 18:54:58 +03:00
/* default values */
typedef struct {
char selcolor[24];
char normcolor[24];
2006-01-31 19:52:14 +03:00
char *font;
unsigned int border;
unsigned int title;
unsigned int snap;
2006-01-31 19:52:14 +03:00
unsigned int selfg;
unsigned int selbg;
unsigned int selborder;
unsigned int normfg;
unsigned int normbg;
unsigned int normborder;
2006-01-31 15:25:23 +03:00
} Default;
Default def;
2005-12-27 23:13:50 +03:00
Atom wm_state; /* TODO: Maybe replace with wm_atoms[WM_ATOM_COUNT]? */
2005-12-05 01:45:59 +03:00
Atom wm_change_state;
Atom wm_protocols;
Atom wm_delete;
Atom motif_wm_hints;
2005-12-27 23:13:50 +03:00
Atom net_atoms[NET_ATOM_COUNT];
2005-11-18 18:54:58 +03:00
2005-12-05 01:45:59 +03:00
Cursor normal_cursor;
Cursor resize_cursor;
Cursor move_cursor;
Cursor drag_cursor;
Cursor w_cursor;
Cursor e_cursor;
Cursor n_cursor;
Cursor s_cursor;
Cursor nw_cursor;
Cursor ne_cursor;
Cursor sw_cursor;
Cursor se_cursor;
2005-11-18 18:54:58 +03:00
2005-12-05 01:45:59 +03:00
unsigned int valid_mask, num_lock_mask;
2005-11-18 18:54:58 +03:00
/* client.c */
Client *alloc_client(Window w, XWindowAttributes *wa);
2005-12-05 22:38:03 +03:00
void destroy_client(Client * c);
2005-12-05 01:45:59 +03:00
void configure_client(Client * c);
void handle_client_property(Client * c, XPropertyEvent * e);
void close_client(Client * c);
2005-12-21 18:18:11 +03:00
void draw_client(Client * client);
2005-12-05 01:45:59 +03:00
void gravitate(Client * c, unsigned int tabh, unsigned int bw, int invert);
void grab_client(Client * c, unsigned long mod, unsigned int button);
void ungrab_client(Client * c, unsigned long mod, unsigned int button);
void unmap_client(Client * c);
void map_client(Client * c);
2005-12-05 01:45:59 +03:00
void reparent_client(Client * c, Window w, int x, int y);
2005-12-21 18:18:11 +03:00
void attach_client(Client * c);
void detach_client(Client * c, Bool unmap);
Client *sel_client();
2006-01-26 20:29:49 +03:00
Client *sel_client_of_page(Page *p);
2006-01-26 14:39:20 +03:00
void focus_client(Client *c);
Client *win_to_frame(Window w);
2006-01-26 14:39:20 +03:00
void resize_client(Client *c, XRectangle * r, XPoint * pt);
unsigned int tab_height(Client *c);
unsigned int border_width(Client *c);
2005-11-18 18:54:58 +03:00
/* event.c */
2005-12-05 01:45:59 +03:00
void init_event_hander();
2006-01-31 15:25:23 +03:00
void check_event(IXPConn *c);
2005-11-18 18:54:58 +03:00
/* mouse.c */
2006-01-26 14:56:28 +03:00
void mouse_resize(Client *c, Align align);
void mouse_move(Client *c);
Cursor cursor_for_motion(Client *c, int x, int y);
2005-12-05 01:45:59 +03:00
Align cursor_to_align(Cursor cursor);
Align xy_to_align(XRectangle * rect, int x, int y);
2006-01-26 14:56:28 +03:00
void drop_move(Client *c, XRectangle *new, XPoint *pt);
2005-11-18 18:54:58 +03:00
/* page.c */
2006-01-26 14:56:28 +03:00
Page *alloc_page();
void destroy_page(Page *p);
void focus_page(Page *p);
2005-12-05 01:45:59 +03:00
XRectangle *rectangles(unsigned int *num);
2005-11-18 18:54:58 +03:00
/* column.c */
2006-01-26 20:29:49 +03:00
void arrange_page(Page *p);
void arrange_column(Page *p, Column *col);
2006-01-25 21:41:12 +03:00
void attach_column(Client *c);
2006-01-26 14:39:20 +03:00
void detach_column(Client *c);
void resize_column(Client *c, XRectangle *r, XPoint *pt);
2006-01-26 20:29:49 +03:00
void select_column(Client *c, char *arg);
void new_column(Page *p);
2005-12-05 04:15:25 +03:00
/* wm.c */
/*
2005-12-05 04:15:25 +03:00
void invoke_wm_event(File * f);
void run_action(File * f, void *obj, Action * acttbl);
*/
2005-12-05 04:15:25 +03:00
void scan_wins();
Client *win_to_client(Window w);
int win_proto(Window w);
int win_state(Window w);
/*void handle_after_write(IXPServer * s, File * f);*/
void detach(Client * f, int client_destroyed);
2005-12-05 04:15:25 +03:00
void set_client_state(Client * c, int state);