mirror of
https://github.com/amiwm/amiwm.git
synced 2026-03-24 01:24:15 +00:00
Compare commits
13 Commits
d7e7a8a6a2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e029d5b68d | ||
|
|
6d13d12cd3 | ||
|
|
1f685e250a | ||
|
|
b9e7c7313d | ||
|
|
774f98ef87 | ||
|
|
e3f4248e8f | ||
|
|
599f0a17b3 | ||
|
|
9354a98208 | ||
|
|
0c75c83e3b | ||
|
|
7baebf1316 | ||
|
|
a79992cb7b | ||
|
|
0c5a2c7648 | ||
|
|
ca04f20fec |
105
amiwm.1
105
amiwm.1
@@ -62,13 +62,13 @@ and then de-iconifying it.)
|
||||
.Nm
|
||||
can keep several workbench screens (or just "screens" for short)
|
||||
where windows are displayed.
|
||||
Each screen has a titlebar above it displaying its name, and a few widgets.
|
||||
Each screen has a menubar above it displaying the screen's name, and a few widgets.
|
||||
Screens are controlled with the pointer as follows:
|
||||
.Bl -column "Raise button" "Right-release" XXXX
|
||||
.It Sy Target Ta Sy Operation Ta Sy Description
|
||||
.It Titlebar Ta Left-drag Ta Move screen up/down
|
||||
.It Menubar Ta Left-drag Ta Move screen up/down
|
||||
to reveal/hide other screens.
|
||||
.It Titlebar Ta Right-press Ta Reveal the menus.
|
||||
.It Menubar Ta Right-press Ta Reveal the menus.
|
||||
.It Menu Ta Right-drag Ta Navigate through menus.
|
||||
.It Menu entry Ta Right-release Ta Activate menu entry.
|
||||
.It Icon Ta Double-click Ta Launch program
|
||||
@@ -98,15 +98,24 @@ Empty lines and lines beginning with
|
||||
are ignored.
|
||||
Each other line is a configuration option and its arguments.
|
||||
The options are as follows:
|
||||
.Bl -column highlighttextpen def_tool.info XXXXXX
|
||||
.Bl -column HighlightTextPen def_tool.info XXXXXX
|
||||
.It Option Ta Default Ta Arguments
|
||||
.It Ic AutoRaise Ta Cm off Ta Ar boolean
|
||||
.It Ic BackgroundPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic BarBlockPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic BarDetailPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic BarTrimPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic BatteryInfo Ta Cm off Ta Ar boolean
|
||||
.It Ic BlockPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic CustomIconsOnly Ta Cm off Ta Ar boolean
|
||||
.It Ic DefaultIcon Ta Cm def_tool.info Ta Qq Ar filename
|
||||
.It Ic DetailPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic FastQuit Ta Cm off Ta Ar boolean
|
||||
.It Ic FillPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic FillTextPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic Focus Ta Cm followmouse Ta Cm followmouse Ns | Ns Cm sloppy Ns | Ns Cm clicktotype
|
||||
.It Ic ForceMove Ta Cm manual Ta Cm manual Ns | Ns Cm auto Ns | Ns Cm always
|
||||
.It Ic HighlightTextPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic IconDir Ta "" Ta Qq Ar path
|
||||
.It Ic IconFont Ta "" Ta Qq Ar fontname
|
||||
.It Ic IconPalette Ta Cm system Ta Cm system Ns | Ns Cm magicwb Ns | Ns Cm schwartz Ns | Ns Ar filename
|
||||
@@ -117,26 +126,17 @@ The options are as follows:
|
||||
.It Ic OpaqueResize Ta False Ta Ar boolean
|
||||
.It Ic Screen Ta "" Ta Oo Ar number Oc Ar screenname
|
||||
.It Ic ScreenFont Ta "" Ta Qq Ar fontname
|
||||
.It Ic ShadowPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic ShinePen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic ShortLabelIcons Ta Cm off Ta Ar boolean
|
||||
.It Ic SizeBorder Ta Cm right Ta Cm right Ns | Ns Cm bottom Ns | Ns Cm both Ns | Ns Cm none
|
||||
.It Ic Style Ta "" Ta Cm "{" Cm class Qo Ar classname Qc Cm icon Qo Ar filename Qc Cm "}"
|
||||
.It Ic TextPen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic TitleBarClock Ta Cm ... Ta Qq Ar boolean
|
||||
.It Ic TitleClockFormat Ta Qq "%c" Ta Oo Ar number Oc Ar timeformat
|
||||
.It Ic ToolItem Ta "" Ta Ic Separator
|
||||
.It Ic ToolItem Ta "" Ta Qo Ar name Qc Cm { Ar ToolItem Ns s ... Cm }
|
||||
.It Ic ToolItem Ta "" Ta Qo Ar name Qc Qo Ar command Qc Qo Ar hotkey Qc
|
||||
.It Ic ToolItem Ta "" Ta Ic Separator
|
||||
.It Ic backgroundpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic barblockpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic bardetailpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic bartrimpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic blockpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic detailpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic fillpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic filltextpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic highlighttextpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic shadowpen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic shinepen Ta Cm ... Ta Qq Ar colorname
|
||||
.It Ic style Ta "" Ta Cm "{" Cm class Qo Ar classname Qc Cm icon Qo Ar filename Qc Cm "}"
|
||||
.It Ic textpen Ta Cm ... Ta Qq Ar colorname
|
||||
.El
|
||||
.
|
||||
.Pp
|
||||
@@ -149,6 +149,9 @@ Some options, like one of the forms of
|
||||
expect as argument a block of options, one per line, around curly braces.
|
||||
.
|
||||
.Pp
|
||||
Option names are case insensitive.
|
||||
.
|
||||
.Pp
|
||||
For the arguments,
|
||||
.Ar boolean
|
||||
can be
|
||||
@@ -193,51 +196,54 @@ or just move a frame indicating where the window will be after releasing the mou
|
||||
.It Ic OpaqueResize Ar bool
|
||||
Whether resizing a window by dragging its resize handle should resize the window in real time;
|
||||
or just resize a frame indicating the window's final size after releasing the mouse button.
|
||||
.El
|
||||
.
|
||||
.Ss Windows decorations
|
||||
.Bl -tag -width Ds
|
||||
.It Ic ScreenFont Qq Ar fontname
|
||||
Selects a font to use for windowtitles etc.
|
||||
.
|
||||
.It Ic SizeBorder Cm right Ns | Ns Cm bottom Ns | Ns Cm both Ns | Ns Cm none
|
||||
Specifies which border should be enlarged when a sizegadget is present.
|
||||
.El
|
||||
.
|
||||
.It Ic detailpen Qq Ar colorname
|
||||
TODO.
|
||||
.Ss Color options
|
||||
.Bl -tag -width Ds
|
||||
.It Ic BackgroundPen Qq Ar colorname
|
||||
Color for the filling (background) of objects on inactive windows and on the menubar.
|
||||
(buttons, window decorations and titlebar, etc).
|
||||
.
|
||||
.It Ic blockpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic BarBlockPen Qq Ar colorname
|
||||
Color for the menubar's filling.
|
||||
.
|
||||
.It Ic textpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic BarDetailPen Qq Ar colorname
|
||||
Color for the screen's name on the menubar, and the menu entries' labels.
|
||||
.
|
||||
.It Ic shinepen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic BarTrimPen Qq Ar colorname
|
||||
Color for the menubar's border, and the widgets on the menubar.
|
||||
.
|
||||
.It Ic shadowpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic DetailPen Qq Ar colorname
|
||||
Color set by libami, currently unused.
|
||||
.
|
||||
.It Ic fillpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic BlockPen Qq Ar colorname
|
||||
Color set by libami, currently unused.
|
||||
.
|
||||
.It Ic filltextpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic FillPen Qq Ar colorname
|
||||
Color for the filling (background) of objects on active windows
|
||||
(buttons, window decorations and titlebar, etc).
|
||||
.
|
||||
.It Ic backgroundpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic FillTextPen Qq Ar colorname
|
||||
Color for the text (foreground) of objects on active windows
|
||||
(buttons, window decorations and titlebar, etc).
|
||||
.
|
||||
.It Ic highlighttextpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic HighlightTextPen Qq Ar colorname
|
||||
Special color text, used on background by libami.
|
||||
.
|
||||
.It Ic bardetailpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic ShadowPen Qq Ar colorname
|
||||
Color for the dark edge on 3D objects
|
||||
(buttons, titlebars, handles, etc; both active and inactive).
|
||||
.
|
||||
.It Ic barblockpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic ShinePen Qq Ar colorname
|
||||
Color for the bright edge on 3D objects
|
||||
(buttons, titlebars, handles, etc; both active and inactive).
|
||||
.
|
||||
.It Ic bartrimpen Qq Ar colorname
|
||||
TODO.
|
||||
.It Ic TextPen Qq Ar colorname
|
||||
Color for the filling (background) of objects on inactive windows and on the menubar.
|
||||
(buttons, window decorations and titlebar, etc).
|
||||
.El
|
||||
.
|
||||
.Ss Icon options
|
||||
@@ -308,6 +314,9 @@ strings in amiwmrc.
|
||||
.
|
||||
.Ss TitleBar and MenuBar
|
||||
.Bl -tag -width Ds
|
||||
.It Ic ScreenFont Qq Ar fontname
|
||||
Selects a font to use for windowtitles and menubar.
|
||||
.
|
||||
.It Ic BatteryInfo Ar boolean
|
||||
This lets you display battery information on the menu bar.
|
||||
It reqiures a module (such as Battery)
|
||||
|
||||
8
client.c
8
client.c
@@ -173,7 +173,7 @@ void close_fscrn(Client *c, int state)
|
||||
{
|
||||
if (c->fsscr == NULL)
|
||||
return;
|
||||
XReparentWindow(dpy, c->parent, c->scr, c->x, c->y);
|
||||
XReparentWindow(dpy, c->parent, c->scr->back, c->x, c->y);
|
||||
XMoveResizeWindow(dpy, c->parent, c->x, c->y, c->pwidth, c->pheight);
|
||||
XMoveResizeWindow(dpy, c->window, 4, c->scr->bh, c->pwidth-c->framewidth, c->pheight-c->frameheight);
|
||||
XResizeWindow(dpy, c->window, c->pwidth-c->framewidth, c->pheight-c->frameheight);
|
||||
@@ -204,7 +204,7 @@ void setclientstate(Client *c, int state)
|
||||
}
|
||||
}
|
||||
c->state = state;
|
||||
XChangeProperty(dpy, c->window, wm_state, wm_state, 32,
|
||||
XChangeProperty(dpy, c->window, ATOMS[WM_STATE], ATOMS[WM_STATE], 32,
|
||||
PropModeReplace, (unsigned char *)data, 2);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ void getstate(Client *c)
|
||||
{
|
||||
long *data=NULL;
|
||||
|
||||
if(_getprop(c->window, wm_state, wm_state, 2l, (char **)&data)>0) {
|
||||
if(_getprop(c->window, ATOMS[WM_STATE], ATOMS[WM_STATE], 2l, (char **)&data)>0) {
|
||||
c->state=*data;
|
||||
XFree((char *)data);
|
||||
}
|
||||
@@ -446,7 +446,7 @@ reparent_client(Scrn *s, Client *client)
|
||||
if(client->parent != client->scr->root)
|
||||
XReparentWindow(dpy, client->parent, s->back, client->x, client->y);
|
||||
if (s->deftitle != NULL)
|
||||
setstringprop(client->window, amiwm_screen, s->deftitle);
|
||||
setstringprop(client->window, ATOMS[AMIWM_SCREEN], s->deftitle);
|
||||
sendconfig(client);
|
||||
}
|
||||
|
||||
|
||||
6
frame.c
6
frame.c
@@ -190,7 +190,7 @@ void reparent(Client *c)
|
||||
c->scr = lc->fsscr;
|
||||
else
|
||||
c->scr = lc->scr;
|
||||
} else if(XGetTextProperty(dpy, c->window, &screen_prop, amiwm_screen)) {
|
||||
} else if(XGetTextProperty(dpy, c->window, &screen_prop, ATOMS[AMIWM_SCREEN])) {
|
||||
do {
|
||||
if(s->root == scr->root &&
|
||||
(!s->deftitle[screen_prop.nitems])&&!strncmp(s->deftitle,
|
||||
@@ -329,7 +329,7 @@ void reparent(Client *c)
|
||||
XMapSubwindows(dpy, c->parent);
|
||||
sendconfig(c);
|
||||
if (scr->deftitle != NULL)
|
||||
setstringprop(c->window, amiwm_screen, scr->deftitle);
|
||||
setstringprop(c->window, ATOMS[AMIWM_SCREEN], scr->deftitle);
|
||||
if(prefs.focus == FOC_CLICKTOTYPE)
|
||||
XGrabButton(dpy, Button1, AnyModifier, c->parent, True,
|
||||
ButtonPressMask, GrabModeSync, GrabModeAsync, None, wm_curs);
|
||||
@@ -737,7 +737,7 @@ void gadgetunclicked(Client *c, XEvent *e)
|
||||
redraw(c, w);
|
||||
if(w==c->close) {
|
||||
if((c->proto & Pdelete)&&!(e->xbutton.state&ShiftMask))
|
||||
sendcmessage(c->window, wm_protocols, wm_delete);
|
||||
sendcmessage(c->window, ATOMS[WM_PROTOCOLS], ATOMS[WM_DELETE_WINDOW]);
|
||||
else
|
||||
XKillClient(dpy, c->window);
|
||||
} else if(w==c->depth)
|
||||
|
||||
184
gnome.c
184
gnome.c
@@ -1,184 +0,0 @@
|
||||
/* GNOME Window Manager Compliance support for amiwm
|
||||
by Peter Bortas february 2000 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
|
||||
extern void gnome_setup()
|
||||
{
|
||||
/* Section 1 - Detection of a GNOME compliant Window Manager
|
||||
|
||||
There is a single unambiguous way to detect if there currently is
|
||||
a GNOME compliant Window Manager running. It is the job of the
|
||||
Window Manager to set up a few things to make this
|
||||
possible. Using the following method it is also possible for
|
||||
applications to detect compliance by receiving an event when the
|
||||
Window Manager exits.
|
||||
|
||||
To do this the Window Manager should create a Window, that is a
|
||||
child of the root window. There is no need to map it, just create
|
||||
it. The Window Manager may reuse ANY window it has for this
|
||||
purpose - even if it is mapped, just as long as the window is
|
||||
never destroyed while the Window Manager is running.
|
||||
|
||||
Once the Window is created the Window Manager should set a
|
||||
property on the root window of the name _WIN_SUPPORTING_WM_CHECK,
|
||||
and type CARDINAL. The atom's data would be a CARDINAL that is
|
||||
the Window ID of the window that was created above. The window
|
||||
that was created would ALSO have this property set on it with the
|
||||
same values and type.*/
|
||||
|
||||
Display *disp;
|
||||
Window root_window;
|
||||
Atom atom_set;
|
||||
CARD32 val;
|
||||
Window win;
|
||||
|
||||
Atom list[10];
|
||||
|
||||
atom_set = XInternAtom(disp, "_WIN_SUPPORTING_WM_CHECK", False);
|
||||
win = XCreateSimpleWindow(disp, root_window, -200, -200, 5, 5, 0, 0, 0);
|
||||
val = win;
|
||||
XChangeProperty(disp, root_window, atom_set, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)&val, 1);
|
||||
XChangeProperty(disp, win, atom_set, XA_CARDINAL, 32, PropModeReplace,
|
||||
(unsigned char *)&val, 1);
|
||||
|
||||
/* Section 2 - Listing GNOME Window Manager Compliance
|
||||
|
||||
It is important to list which parts of GNOME Window Manager
|
||||
compliance are supported. This is done fairly easily by doing the
|
||||
following:
|
||||
|
||||
Create a property on the root window of the atom name
|
||||
_WIN_PROTOCOLS. This property contains a list(array)of atoms that
|
||||
are all the properties the Window Manager supports. These atoms
|
||||
are any number of the following:
|
||||
|
||||
_WIN_LAYER
|
||||
_WIN_STATE
|
||||
_WIN_HINTS
|
||||
_WIN_APP_STATE
|
||||
_WIN_EXPANDED_SIZE
|
||||
_WIN_ICONS
|
||||
_WIN_WORKSPACE
|
||||
_WIN_WORKSPACE_COUNT
|
||||
_WIN_WORKSPACE_NAMES
|
||||
_WIN_CLIENT_LIST
|
||||
|
||||
If you list one of these properties then you support it and
|
||||
applications can expect information provided by, or accepted by
|
||||
the Window Manager to work. */
|
||||
|
||||
atom_set = XInternAtom(disp, "_WIN_PROTOCOLS", False);
|
||||
list[0] = XInternAtom(disp, "_WIN_LAYER", False);
|
||||
list[1] = XInternAtom(disp, "_WIN_STATE", False);
|
||||
list[2] = XInternAtom(disp, "_WIN_HINTS", False);
|
||||
list[3] = XInternAtom(disp, "_WIN_APP_STATE", False);
|
||||
list[4] = XInternAtom(disp, "_WIN_EXPANDED_SIZE", False);
|
||||
list[5] = XInternAtom(disp, "_WIN_ICONS", False);
|
||||
list[6] = XInternAtom(disp, "_WIN_WORKSPACE", False);
|
||||
list[7] = XInternAtom(disp, "_WIN_WORKSPACE_COUNT", False);
|
||||
list[8] = XInternAtom(disp, "_WIN_WORKSPACE_NAMES", False);
|
||||
list[9] = XInternAtom(disp, "_WIN_CLIENT_LIST", False);
|
||||
XChangeProperty(disp, root_window, atom_set, XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char *)list, 10);
|
||||
}
|
||||
|
||||
extern void gnome_managed_clients()
|
||||
{
|
||||
/* Section 3 - Providing Shortcuts Managed Clients
|
||||
|
||||
As an aide in having external applications be able to list and
|
||||
access clients being managed by the Window Manager, a property
|
||||
should be set on the root window of the name _WIN_CLIENT_LIST
|
||||
which is an array of type CARDINAL. Each entry is the Window ID
|
||||
of a managed client. If the list of managed clients changes,
|
||||
clients are added or deleted, this list should be updated. */
|
||||
|
||||
Display *disp;
|
||||
Window root_window;
|
||||
Atom atom_set;
|
||||
Window *wl;
|
||||
int num;
|
||||
|
||||
fprintf(stderr, "FIXME: snome_managed_clients is a stub\n");
|
||||
|
||||
atom_set = XInternAtom(disp, "_WIN_CLIENT_LIST", False);
|
||||
num = 0; /* FIXME: number of clients goes here */
|
||||
wl = malloc(sizeof(Window) * num);
|
||||
/* FIXME: Fill in array of window ID's */
|
||||
XChangeProperty(disp, root_window, atom_set, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)wl, num);
|
||||
if (wl)
|
||||
free(wl);
|
||||
}
|
||||
|
||||
extern void gnome_multiple_desktops()
|
||||
{
|
||||
/* Section 3 - Providing Multiple/Virtual Desktop Information.
|
||||
|
||||
If your Window Manager supports the concept of Multiple/Virtual
|
||||
Desktops or Workspaces then you will definitely want to include
|
||||
it. This involves your Window Manager setting several properties
|
||||
on the root window.
|
||||
|
||||
First you should advertise how many Desktops your Window Manager
|
||||
supports. This is done by setting a property on the root window
|
||||
with the atom name _WIN_WORKSPACE_COUNT of type CARDINAL. The
|
||||
properties data is a 32-bit integer that is the number of
|
||||
Desktops your Window Manager currently supports. If you can add
|
||||
and delete desktops while running, you may change this property
|
||||
and its value whenever required. You should also set a property
|
||||
of the atom _WIN_WORKSPACE of type CARDINAL that contains the
|
||||
number of the currently active desktop (which is a number between
|
||||
0 and the number advertised by _WIN_WORKSPACE_COUNT -
|
||||
1). Whenever the active desktop changes, change this property.
|
||||
|
||||
Lastly you should set a property that is a list of strings called
|
||||
_WIN_WORKSPACE_NAMES that contains names for the desktops (the
|
||||
first string is the name of the first desktop, the second string
|
||||
is the second desktop, etc.). This will allow applications toq
|
||||
know what the name of the desktop is too, possibly to display it. */
|
||||
|
||||
Display *disp;
|
||||
Window root_window;
|
||||
Atom atom_set;
|
||||
XTextProperty text;
|
||||
int i, current_desk, number_of_desks;
|
||||
char **names, s[1024];
|
||||
CARD32 val;
|
||||
|
||||
/* FIXME: set current_desk, number_of_desks names */
|
||||
|
||||
atom_set = XInternAtom(disp, "_WIN_WORKSPACE", False);
|
||||
val = (CARD32) current_desk;
|
||||
XChangeProperty(disp, root_window, atom_set, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)&val, 1);
|
||||
atom_set = XInternAtom(disp, "_WIN_WORKSPACE_COUNT", False);
|
||||
|
||||
val = (CARD32) number_of_desks;
|
||||
XChangeProperty(disp, root_window, atom_set, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)&val, 1);
|
||||
atom_set = XInternAtom(disp, "_WIN_WORKSPACE_NAMES", False);
|
||||
names = malloc(sizeof(char *) * number_of_desks);
|
||||
for (i = 0; i < number_of_desks; i++)
|
||||
{
|
||||
snprintf(s, sizeof(s), "Desktop %i", i);
|
||||
names[i] = malloc(strlen(s) + 1);
|
||||
strcpy(names[i], s);
|
||||
}
|
||||
if (XStringListToTextProperty(names, mode.numdesktops, ))
|
||||
{
|
||||
XSetTextProperty(disp, root_window, &val, atom_set);
|
||||
XFree(text.value);
|
||||
}
|
||||
for (i = 0; i < number_of_desks; i++)
|
||||
free(names[i]);
|
||||
free(names);
|
||||
}
|
||||
104
icc.c
104
icc.c
@@ -1,3 +1,5 @@
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#include "drawinfo.h"
|
||||
#include "screen.h"
|
||||
#include "icc.h"
|
||||
@@ -5,7 +7,7 @@
|
||||
#include "style.h"
|
||||
#include "prefs.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -16,54 +18,34 @@ extern struct Library *XLibBase;
|
||||
|
||||
extern void redraw(Client *, Window);
|
||||
|
||||
Atom utf8_string, net_wm_name;
|
||||
Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus;
|
||||
Atom wm_colormaps, wm_name, wm_normal_hints, wm_hints, wm_icon_name, wm_class;
|
||||
Atom net_supporting_wm_check, net_supported, net_wm_state, net_wm_state_fullscreen;
|
||||
Atom amiwm_screen, swm_vroot, amiwm_wflags, amiwm_appiconmsg, amiwm_appwindowmsg;
|
||||
Atom ATOMS[NATOMS];
|
||||
|
||||
extern Display *dpy;
|
||||
extern char *progname;
|
||||
|
||||
void init_atoms()
|
||||
{
|
||||
utf8_string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||
wm_state = XInternAtom(dpy, "WM_STATE", False);
|
||||
wm_change_state = XInternAtom(dpy, "WM_CHANGE_STATE", False);
|
||||
wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
||||
wm_delete = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
|
||||
wm_take_focus = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
|
||||
wm_colormaps = XInternAtom(dpy, "WM_COLORMAP_WINDOWS", False);
|
||||
wm_name = XInternAtom(dpy, "WM_NAME", False);
|
||||
wm_normal_hints = XInternAtom(dpy, "WM_NORMAL_HINTS", False);
|
||||
wm_hints = XInternAtom(dpy, "WM_HINTS", False);
|
||||
wm_icon_name = XInternAtom(dpy, "WM_ICON_NAME", False);
|
||||
wm_class = XInternAtom(dpy, "WM_CLASS", False);
|
||||
net_supported = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
||||
net_supporting_wm_check = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
net_wm_name = XInternAtom(dpy, "_NET_WM_NAME", False);
|
||||
net_wm_state = XInternAtom(dpy, "_NET_WM_STATE", False);
|
||||
net_wm_state_fullscreen = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||
amiwm_screen = XInternAtom(dpy, "AMIWM_SCREEN", False);
|
||||
swm_vroot = XInternAtom(dpy, "__SWM_VROOT", False);
|
||||
amiwm_wflags = XInternAtom(dpy, "AMIWM_WFLAGS", False);
|
||||
amiwm_appiconmsg = XInternAtom(dpy, "AMIWM_APPICONMSG", False);
|
||||
amiwm_appwindowmsg = XInternAtom(dpy, "AMIWM_APPWINDOWMSG", False);
|
||||
static char *atom_names[NATOMS] = {
|
||||
#define X(atom) [atom] = #atom,
|
||||
ATOMS_TABLE(X)
|
||||
#undef X
|
||||
};
|
||||
|
||||
if (!XInternAtoms(dpy, atom_names, NATOMS, False, ATOMS)) {
|
||||
fprintf(stderr, "%s: cannot intern atoms\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void setsupports(Window root, Window checkwin)
|
||||
{
|
||||
Atom atoms[] = {
|
||||
net_wm_state,
|
||||
net_wm_state_fullscreen,
|
||||
};
|
||||
XChangeProperty(dpy, root, net_supported, XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char *)atoms,
|
||||
sizeof(atoms)/sizeof(atoms[0]));
|
||||
XChangeProperty(dpy, root, net_supporting_wm_check, XA_WINDOW, 32,
|
||||
XChangeProperty(dpy, root, ATOMS[_NET_SUPPORTED], XA_ATOM, 32,
|
||||
PropModeReplace, (void *)&ATOMS[_NET_SUPPORTED], NATOMS-_NET_SUPPORTED);
|
||||
XChangeProperty(dpy, root, ATOMS[_NET_SUPPORTING_WM_CHECK], XA_WINDOW, 32,
|
||||
PropModeReplace, (void *)(Window[]){checkwin}, 1);
|
||||
XChangeProperty(dpy, checkwin, net_supporting_wm_check, XA_WINDOW, 32,
|
||||
XChangeProperty(dpy, checkwin, ATOMS[_NET_SUPPORTING_WM_CHECK], XA_WINDOW, 32,
|
||||
PropModeReplace, (void *)(Window[]){checkwin}, 1);
|
||||
XChangeProperty(dpy, checkwin, net_wm_name, utf8_string, 8,
|
||||
XChangeProperty(dpy, checkwin, ATOMS[_NET_WM_NAME], ATOMS[UTF8_STRING], 8,
|
||||
PropModeReplace, (void *)"AmiWM", 5);
|
||||
}
|
||||
|
||||
@@ -86,13 +68,13 @@ void getwmstate(Client *c)
|
||||
Window w;
|
||||
|
||||
w = c->window;
|
||||
if ((n = _getprop(w, net_wm_state, XA_ATOM, 20L, (char**)&p)) < 0)
|
||||
if ((n = _getprop(w, ATOMS[_NET_WM_STATE], XA_ATOM, 20L, (char**)&p)) < 0)
|
||||
return;
|
||||
c->fullscreen = 0;
|
||||
if (!n)
|
||||
return;
|
||||
for (i = 0; i < n; i++)
|
||||
if (p[i] == net_wm_state_fullscreen)
|
||||
if (p[i] == ATOMS[_NET_WM_STATE_FULLSCREEN])
|
||||
c->fullscreen = 1;
|
||||
XFree((char *) p);
|
||||
}
|
||||
@@ -100,13 +82,11 @@ void getwmstate(Client *c)
|
||||
void setwmstate(Client *c)
|
||||
{
|
||||
if (c->fullscreen) {
|
||||
Atom data[] = {
|
||||
net_wm_state_fullscreen
|
||||
};
|
||||
XChangeProperty(dpy, c->window, net_wm_state, XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char *)data, 1);
|
||||
} else
|
||||
XDeleteProperty(dpy, c->window, net_wm_state);
|
||||
XChangeProperty(dpy, c->window, ATOMS[_NET_WM_STATE], XA_ATOM, 32, PropModeReplace,
|
||||
(void *)&ATOMS[_NET_WM_STATE_FULLSCREEN], 1);
|
||||
} else {
|
||||
XDeleteProperty(dpy, c->window, ATOMS[_NET_WM_STATE]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +119,7 @@ void getwflags(Client *c)
|
||||
long n;
|
||||
|
||||
c->wflags = 0;
|
||||
if ((n = _getprop(c->window, amiwm_wflags, amiwm_wflags, 1L, (char**)&p)) <= 0)
|
||||
if ((n = _getprop(c->window, ATOMS[AMIWM_WFLAGS], ATOMS[AMIWM_WFLAGS], 1L, (char**)&p)) <= 0)
|
||||
return;
|
||||
|
||||
c->wflags = p[0];
|
||||
@@ -156,13 +136,13 @@ void getproto(Client *c)
|
||||
|
||||
w = c->window;
|
||||
c->proto &= ~(Pdelete|Ptakefocus);
|
||||
if ((n = _getprop(w, wm_protocols, XA_ATOM, 20L, (char**)&p)) <= 0)
|
||||
if ((n = _getprop(w, ATOMS[WM_PROTOCOLS], XA_ATOM, 20L, (char**)&p)) <= 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
if (p[i] == wm_delete)
|
||||
if (p[i] == ATOMS[WM_DELETE_WINDOW])
|
||||
c->proto |= Pdelete;
|
||||
else if (p[i] == wm_take_focus)
|
||||
else if (p[i] == ATOMS[WM_TAKE_FOCUS])
|
||||
c->proto |= Ptakefocus;
|
||||
|
||||
XFree((char *) p);
|
||||
@@ -202,7 +182,7 @@ void checkstyle(Client *c)
|
||||
if(prefs.firststyle==NULL)
|
||||
return;
|
||||
|
||||
if(!XGetTextProperty(dpy, c->window, &class_name, wm_class))
|
||||
if(!XGetTextProperty(dpy, c->window, &class_name, XA_WM_CLASS))
|
||||
class_name.value=NULL;
|
||||
else
|
||||
/* This value seems to be 2x it's correct value always... */
|
||||
@@ -237,7 +217,7 @@ void propertychange(Client *c, Atom a)
|
||||
extern void checksizehints(Client *);
|
||||
extern void newicontitle(Client *);
|
||||
|
||||
if(a==wm_name) {
|
||||
if(a==XA_WM_NAME) {
|
||||
#ifdef USE_FONTSETS
|
||||
XTextProperty prop;
|
||||
if(c->title) {
|
||||
@@ -265,9 +245,9 @@ void propertychange(Client *c, Atom a)
|
||||
XClearWindow(dpy, c->drag);
|
||||
redraw(c, c->drag);
|
||||
}
|
||||
} else if(a==wm_normal_hints) {
|
||||
} else if(a==XA_WM_NORMAL_HINTS) {
|
||||
checksizehints(c);
|
||||
} else if(a==wm_hints) {
|
||||
} else if(a==XA_WM_HINTS) {
|
||||
XWMHints *xwmh;
|
||||
if((xwmh=XGetWMHints(dpy, c->window))) {
|
||||
if((xwmh->flags&(IconWindowHint|IconPixmapHint))&&c->icon) {
|
||||
@@ -281,25 +261,25 @@ void propertychange(Client *c, Atom a)
|
||||
}
|
||||
XFree(xwmh);
|
||||
}
|
||||
} else if(a==wm_protocols) {
|
||||
} else if(a==ATOMS[WM_PROTOCOLS]) {
|
||||
getproto(c);
|
||||
} else if(a==wm_icon_name) {
|
||||
} else if(a==XA_WM_ICON_NAME) {
|
||||
if(c->style==NULL)
|
||||
checkstyle(c);
|
||||
if(c->icon) newicontitle(c);
|
||||
} else if(a==wm_state) {
|
||||
} else if(a==ATOMS[WM_STATE]) {
|
||||
if(c->parent==c->scr->root) {
|
||||
getstate(c);
|
||||
if(c->state==NormalState)
|
||||
c->state=WithdrawnState;
|
||||
}
|
||||
} else if(a==wm_class && c->style==NULL)
|
||||
} else if(a==XA_WM_CLASS && c->style==NULL)
|
||||
checkstyle(c);
|
||||
}
|
||||
|
||||
void handle_client_message(Client *c, XClientMessageEvent *xcme)
|
||||
{
|
||||
if(xcme->message_type == wm_change_state) {
|
||||
if(xcme->message_type == ATOMS[WM_CHANGE_STATE]) {
|
||||
int state=xcme->data.l[0];
|
||||
if(state==IconicState)
|
||||
if(c->state!=IconicState) {
|
||||
@@ -328,10 +308,10 @@ void handle_client_message(Client *c, XClientMessageEvent *xcme)
|
||||
XMapRaised(dpy, c->parent);
|
||||
setclientstate(c, NormalState);
|
||||
}
|
||||
} else if (xcme->message_type == net_wm_state) {
|
||||
} else if (xcme->message_type == ATOMS[_NET_WM_STATE]) {
|
||||
int action=xcme->data.l[0];
|
||||
Atom prop=xcme->data.l[1];
|
||||
if (prop == net_wm_state_fullscreen)
|
||||
if (prop == ATOMS[_NET_WM_STATE_FULLSCREEN])
|
||||
switch (action) {
|
||||
case 0: fullscreen(c, 0); break; /* _NET_WM_STATE_REMOVE */
|
||||
case 1: fullscreen(c, 1); break; /* _NET_WM_STATE_ADD */
|
||||
|
||||
35
icc.h
35
icc.h
@@ -17,15 +17,12 @@ extern long _getprop(Window, Atom, Atom, long, char **);
|
||||
extern void getwflags(Client *);
|
||||
extern Window get_transient_for(Window);
|
||||
|
||||
extern Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus, wm_colormaps, wm_hints, amiwm_screen, swm_vroot;
|
||||
|
||||
#define Pdelete 1
|
||||
#define Ptakefocus 2
|
||||
#define Psizebottom 4
|
||||
#define Psizeright 8
|
||||
#define Psizetrans 16
|
||||
|
||||
|
||||
#define mkcmessage(w, a, x, ...) (&(XEvent){.xclient = { \
|
||||
.type = ClientMessage, \
|
||||
.window = (w), \
|
||||
@@ -34,4 +31,36 @@ extern Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus, w
|
||||
.data.l = {(long)(x), CurrentTime, __VA_ARGS__}, \
|
||||
}})
|
||||
|
||||
#define NET_ATOMS \
|
||||
X(_NET_SUPPORTING_WM_CHECK) \
|
||||
X(_NET_WM_NAME) \
|
||||
X(_NET_WM_STATE) \
|
||||
X(_NET_WM_STATE_FULLSCREEN) \
|
||||
|
||||
#define ATOMS_TABLE(X) \
|
||||
X(__SWM_VROOT) \
|
||||
X(AMIWM_APPICONMSG) \
|
||||
X(AMIWM_APPWINDOWMSG) \
|
||||
X(AMIWM_SCREEN) \
|
||||
X(AMIWM_WFLAGS) \
|
||||
X(UTF8_STRING) \
|
||||
X(WM_CHANGE_STATE) \
|
||||
X(WM_CLASS) \
|
||||
X(WM_COLORMAP_WINDOWS) \
|
||||
X(WM_DELETE_WINDOW) \
|
||||
X(WM_PROTOCOLS) \
|
||||
X(WM_STATE) \
|
||||
X(WM_TAKE_FOCUS) \
|
||||
X(_NET_SUPPORTED) \
|
||||
NET_ATOMS /* this must come last */
|
||||
|
||||
enum {
|
||||
#define X(atom) atom,
|
||||
ATOMS_TABLE(X)
|
||||
NATOMS
|
||||
#undef X
|
||||
};
|
||||
|
||||
extern Atom ATOMS[NATOMS];
|
||||
|
||||
#endif
|
||||
|
||||
6
main.c
6
main.c
@@ -758,11 +758,10 @@ static void drag_icon(Scrn *s, Time time, int x_root, int y_root)
|
||||
|
||||
if (c != NULL) {
|
||||
if (c->module != NULL) {
|
||||
extern Atom amiwm_appwindowmsg;
|
||||
XTranslateCoordinates(dpy, s->back, c->window, -4, -4, &wx, &wy, &ch);
|
||||
for (int n = 0; n < nicons; n++) {
|
||||
dispatch_event_to_broker(mkcmessage(
|
||||
c->window, amiwm_appwindowmsg,dragging[n].icon->window,
|
||||
c->window, ATOMS[AMIWM_APPWINDOWMSG],dragging[n].icon->window,
|
||||
dragging[n].x + wx, dragging[n].y + wy
|
||||
), 0, c->module);
|
||||
}
|
||||
@@ -878,13 +877,12 @@ static void drag_resize(Client *c, Time time, int x_root, int y_root)
|
||||
|
||||
static void do_icon_double_click(Scrn *scr)
|
||||
{
|
||||
extern Atom amiwm_appiconmsg;
|
||||
Icon *i, *next;
|
||||
|
||||
for(i=scr->firstselected; i; i=next) {
|
||||
next=i->nextselected;
|
||||
if(i->module) {
|
||||
dispatch_event_to_broker(mkcmessage(i->window, amiwm_appiconmsg, 0),
|
||||
dispatch_event_to_broker(mkcmessage(i->window, ATOMS[AMIWM_APPICONMSG], 0),
|
||||
0, i->module);
|
||||
} else {
|
||||
deiconify(i);
|
||||
|
||||
4
screen.c
4
screen.c
@@ -61,9 +61,9 @@ void setvirtualroot(Scrn *s)
|
||||
|
||||
if(s==old_vroot) return;
|
||||
if(old_vroot)
|
||||
XDeleteProperty(dpy, old_vroot->back, swm_vroot);
|
||||
XDeleteProperty(dpy, old_vroot->back, ATOMS[__SWM_VROOT]);
|
||||
setvroot(s->root, s);
|
||||
XChangeProperty(dpy, s->back, swm_vroot, XA_WINDOW, 32, PropModeReplace,
|
||||
XChangeProperty(dpy, s->back, ATOMS[__SWM_VROOT], XA_WINDOW, 32, PropModeReplace,
|
||||
(unsigned char *)&(s->back), 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user