/* * This file is part of firk's window manager library (libfwm) * Copyright (C) 2023 firk * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _LIBFWM_LIBFWM_H_ #define _LIBFWM_LIBFWM_H_ #define display LIBFWM_display #define screen LIBFWM_screen #define rootwin LIBFWM_rootwin #define logprint LIBFWM_logprint #define failprint LIBFWM_failprint #ifdef LIBFWM_INTERNAL #define colors LIBFWM_colors #endif #define base_color LIBFWM_base_color #define get_ms LIBFWM_get_ms extern Display *display; extern Screen *screen; extern Window rootwin; extern unsigned long LIBFWM_colors[16]; extern void logprint(char const * fmt, ...); extern void failprint(char const * fmt, ...); extern void LIBFWM_Init(char const *program_name, char const *display_name); extern unsigned long base_color(unsigned char c); extern int LIBFWM_SetWClass(Window w, unsigned char cat, char const *wcl); extern Window LIBFWM_CreateTrayIcon(int is_wide, char const *class, unsigned long background_pixel, long event_mask); extern unsigned long get_ms(void); extern int LIBFWM_WaitEventTimeout(unsigned int timeout, int nointr); extern int LIBFWM_WaitEventUntil(unsigned long until, int nointr); extern Pixmap LIBFWM_CreateIconPixmap(unsigned char const *data, unsigned short w, unsigned short h); extern Window LIBFWM_CreateWidgetWindow(unsigned char type, char const *class, char const *title, int x0, int y0, unsigned int w, unsigned int h, unsigned int bw, unsigned long background_pixel, unsigned long border_pixel, long event_mask, Bool override_redirect); #define atoms_length 10 #define atoms LIBFWM_atoms extern Atom atoms[atoms_length]; #ifdef LIBFWM_INTERNAL_2 static char const *atom_names[atoms_length] = { "WM_PROTOCOLS", "WM_DELETE_WINDOW", "WM_TAKE_FOCUS", "WM_STATE", "WM_HINTS", "WM_TRANSIENT_FOR", "WM_NAME", "FWM_WCLASS", "FWM_THEMESET", "FWM_TRAYSIZE" }; #endif #define atom_WM_PROTOCOLS (atoms[0]) #define atom_WM_DELETE (atoms[1]) #define atom_WM_TAKEFOCUS (atoms[2]) #define atom_WM_STATE (atoms[3]) #define atom_WM_HINTS (atoms[4]) #define atom_WM_TRANSFOR (atoms[5]) #define atom_WM_NAME (atoms[6]) #define atom_FWM_WCLASS (atoms[7]) #define atom_FWM_THEMESET (atoms[8]) #define atom_FWM_TRAYSIZE (atoms[9]) /* WCLASS format: byte [0] is generic id from those below; bytes [1+] is ASCII identifier, maximum 30 bytes w/o nullterm FWM_WCLASS property should be already present on window mapping if needed */ #define WCLASS_NORMAL 1 #define WCLASS_TRAYICON 2 /* 16x16 */ #define WCLASS_TRAYWIDE 3 /* 40x16 */ #define WCLASS_WIDGET 4 /* THEMESET format: byte [0] is flags (bit0: 0=dark 1=light) bytes [1+] is optional ASCII identifier (currently not used) FWM_THEMESET in WM_PROTOCOLS should be already present on window mapping if needed */ #define BLACK 0 #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define MAGENTA 5 #define BROWN 6 #define LTGRAY 7 #define DKGRAY 8 #define LTBLUE 9 #define LTGREEN 10 #define LTCYAN 11 #define LTRED 12 #define PINK 13 #define YELLOW 14 #define WHITE 15 #endif