Commit Graph

15 Commits

Author SHA1 Message Date
Lucas de Sena
599f0a17b3 localize menu routines
Keep state loal into drag_menu() in menu.c, rather than in global
variables around menu.c and main.c
2026-02-24 00:25:46 +00:00
Lucas de Sena
9354a98208 localize button click routines
Keep state local into click_*() for routines relating to button clicks
than in global variables around frame.c and main.c
2026-02-24 00:25:46 +00:00
Lucas de Sena
ca04f20fec implement a table of atoms defined only once
Previously, adding a new atom into the code required:
1. In <icc.h>, add the line `extern Atom my_new_atom;` declaring the new atom.
2. In <icc.c>, add the line `Atom my_new_atom;` defining the new atom.
3. In <icc.c>, add the line `my_new_atom = XInternAtom(dpy, "MY_NEW_ATOM", False);`
   interning this new atom, and assigning the interned value to the variable.

Now, just add a line with the atom's name in the X-MACRO in <icc.h>, and
a XInternAtoms(3) and a set of macros will do the rest.

All new atoms will be referred to as an entry in the ATOMS[] array.
For example:

	ATOMS[MY_NEW_ATOM]

The exception are for those REALLY OLD atoms that have already a
dedicated compile-time-known value defined at <X11/Xatom.h>.  Those
do not need to be interned; and are referred to with a constant
beginning with the `XA_` prefix.  For example:

	XA_WM_CLASS
2026-02-19 20:22:50 +00:00
Adrian Chadd
f3fc2a7015 Merge pull request #26 from phillbush/localize
Localize
2026-02-05 03:38:04 +00:00
Lucas de Sena
6685043266 make dialog clients be iconified/re-screened with their respective leader client 2026-02-04 16:12:48 +00:00
Lucas de Sena
8a59e5cc9e localize control flow and variables
State and control flow for modal mouse actions (dragging/resizing/etc)
was fragmented and scattered through main.c, making code convoluted and
hard to maintain.

I fixed that by applying good structured programming practics:
implementing sub-event-loops for those modal actions, rather than
checking which modal action is currently in action at the main
event-loop.

That commit took me more time than i expected... abstract out all
spaghettish, global-state control flow into a single, encapsulated
scope for each modal action… test if i broke anything… find any dead
code that is not used anymore (implementing that global state we had
before)…

I also put some `static` in global variables and routines, so the
compile can warn whether an unused variable/function is defined (and
help me on removing dead code).
2026-01-31 01:52:24 +00:00
Lucas de Sena
a8f92b4e5b Make fullscreen work on GTK applications
This commit implements the _NET_SUPPORTING_WM_CHECK property, defined
by the EWMH[1] (Extended Window Management Hints, aka wm-spec), which
indicates that a EWMH-compliant window manager is running.

A GTK application, when set to go fullscreen, first checks root window's
_NET_SUPPORTING_WM_CHECK property to determine whether a EWMH-compliant
window manager is running; and then checks the _NET_SUPPORTED property
to determine the supported protocols.

_NET_SUPPORTED was previously implemented, but _NET_SUPPORTING_WM_CHECK
was not.


This commit also fixes a misconception of the code related to screens.

The code deals with two different, unrelated concepts of screens: the
X11 screen, and the AmiWM screen.

The X11 screen, created by the X server independently of whether a
window manager is running, is a kind of “subdisplay”.  A X11 display
structure, which describes a connection to the X server, has one or more
screens.  Each X11 screen has its own root window and its own set of
clients that are specific to it, and cannot move to another X11 screen.
The user can even run two different window managers at the same time in
the same display, given that each is run in a different X11 screen.
Usually, there is only one X11 screen.

The _NET_SUPPORTING_WM_CHECK and _NET_SUPPORTED properties must be set
on the root window of each screen that AmiWM is managing.  Previously,
however, they were set everytime an AmiWM screen (a totally different
concept) was realized.  So, if i had 4 AmiWM screens configured in my
~/.amiwmrc file, setsupports() were called four times, even if i only
have a single X11 screen.

[1]: https://specifications.freedesktop.org/wm/latest/index.html
2026-01-10 02:58:39 +00:00
Adrian Chadd
def62797f9 [amiwm] Update to 0.22pl2
This notably includes full screen support!

Addresses Issue #12
2023-12-21 22:09:25 -08:00
Adrian Chadd
229d2b2c4d [amiwm] Fix NULL scr issue
If the clock timer fires when global scr is NULL then we end up calling
redrawmenubar() with a NULL global scr, but a valid local scr.

So just pass in the scr used when doing "stuff" into redrawmenubar(),
making the 'scr' in redrawmenubar() also local scope.
2022-09-05 16:03:55 -07:00
Adrian Chadd
e42512c034 [amiwm] Don't use global scr for this iteration
The global scr is a bit of an overused thing.  It's definitely not
needed here.  Don't use it here.
2022-04-25 19:03:50 -07:00
Adrian Chadd
d00be9ffa8 [amiwm] remove the global 'front' variable
This is a pretty straight forward change to remove the global front
variable and instead use a couple of accessor functions.

This hopefully will make it easier to keep track and debug when
the front screen changes.
2022-04-03 08:20:39 -07:00
Adrian Chadd
26cecc8487 [amiwm] Use XAllocSizeHints() for the sizehints in struct Client
Although it likely doesn't matter /that/ much, the x11 xlib manual
does say to use it rather than expecting the struct to stay the same
size.

Yeah yeah it's 2022 and we really do build things from source,
ICCCM is likely not going to change that much nowdays, etc, etc.
2022-03-12 21:04:24 -08:00
Adrian Chadd
5365f97cbe [amiwm] Do another pass to clean up build warnings
This is mostly a "dangling if" cleanup, but I did add some other
comments here and there!
2022-02-10 12:37:38 -08:00
reddsik
5e6ed1191b Added something that will be a config util later, removed some unusable options from menus(you'll be later able to re-enable them), changed module dir to /lib/amiwm 2017-07-14 13:06:22 +02:00
reddsik
c85716f60e Initial commit! 2017-03-26 13:00:19 +02:00