Commit Graph

66 Commits

Author SHA1 Message Date
Uli Schlachter fb147cf856 XKB update: Use an idle source
Instead of updating the keyboard state at the end of the current main
loop iteration, this now uses a GLib idle source with a very low
priority. This increases the chance of batching multiple refreshes
together. Also, this means that awesome_refresh() does less work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-18 13:45:34 +01:00
Uli Schlachter a22479c97b Screen scanning: Use an idle source
Instead of refreshing screens at the end of the current main loop
iteration, this now uses a GLib idle source with a very low priority.
This increases the chance of batching multiple refreshes together. Also,
this means that awesome_refresh() does less work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-18 10:42:29 +01:00
Uli Schlachter 9f3a6757e9 Asynchronously update the keyboard state
When the keyboard layout is modified via xmodmap, each single "change"
(line of input to xmodmap) causes an "the keyboard configuration
changed"-event to be sent. Awesome reacted to each of these events by
reloading the keyboard layout. Thus, awesome reloaded the keyboard
layout a lot and appeared to freeze.

Fix this by asynchronously update the keyboard state: When such an event
comes in, instead of reloading things immediately, we set a flag which
makes us update the state at the end of the main loop iteration. This
means that many events still cause only a single (or at least few)
re-quering of the layout. Thus, a lot of time is saved.

This commit removes the argument to the (undocumented!) signal
xkb::group_changed. Previously, the argument was the active group
number. Since this argument was unused and I'm lazy, I just removed it.
The alternative would be that it might be visible to Lua that some "the
active group changed"-events are dropped.

Fixes: https://github.com/awesomeWM/awesome/issues/1494
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-28 15:21:01 +02:00
Uli Schlachter 06f02f6004 Delay client frame window destruction (#1148)
Daniel sees a short flicker of his wallpaper when he closes a client.
This happens because the window is destroyed immediately, but other
clients are re-arranged only shortly later. In the mean time, the X
server updates the display and repaints the root window (= wallpaper
becomes visible).

Work around this by delaying the destruction of frame windows to the end
of the current main loop iteration. This means that we first update the
position of all other windows and later destroy the window that was
actually closed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-07 00:46:57 +02:00
Uli Schlachter b0b1e212ec Fix short flicker when new clients appear (#1138)
We are doing more and more things lazily in the C code. The newest
addition is lazily configuring clients, which means that geometry
changes are only applied later.

However, this caused a short flicker when a new client appears: We were
first making the client visible and then moving it to its "proper"
position.

Since unbanning is also done lazily, we just have to change the order in
which we apply these operations to fix this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-06 18:50:13 +02:00
Uli Schlachter 8283a12ec9 Only export a single refresh function for clients
We still need client_focus_refresh() as a separate entry point, because it is
used by event.c.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-15 18:31:29 +02:00
Uli Schlachter b651373cda Stop restarting on RandR changes
This commit adds a "removed" signal to screens. Together with the "added" signal
that we have since a while, this allows the C code to update the list of
available screens dynamically without needing to restart.

So far, this code received only minimal testing. So far, I don't have a nice
idea on how to easily test this...

Closes: https://github.com/awesomeWM/awesome/issues/672
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-01 10:09:26 +02:00
Uli Schlachter 80a6f2f510 Clean up static variables in event_handle
This function needs the event numbers for events from some extensions. These are
assigned dynamically by the server. Right now, this is done by having a bunch of
static variables that are initialized when needed.

Refactor this to have a function event_init() instead that sets variable in
globalconf (where all of our state should be saved). Also, a preprocessor macro
is introduced to handle event dispatch which also looks a bit nicer.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-09 15:44:54 +02:00
Uli Schlachter ee7a41370f Lazily apply changes to border_width and border_color
Fixes: https://github.com/awesomeWM/awesome/issues/592
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-28 16:24:30 +01:00
Uli Schlachter 430f4fab15 Leave titlebars early
When a client is unmanaged, we know emit mouse::leave on its titlebar before the
client object is invalidated, so that Lua can still work with it. Before, this
event was emitted only when we got a LeaveNotify from the X11 server.

Fixes: #620
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-10 19:27:55 +01:00
Uli Schlachter 9408b61a97 drawin: lazily configure drawin windows
Ref: https://github.com/awesomeWM/awesome/issues/411.
Source: https://github.com/awesomeWM/awesome/pull/174#commitcomment-12708326.
(With some minor changes)
2015-08-23 15:25:23 +02:00
Uli Schlachter d2b1e92f9e Clean up header includes
Every .c file has to include the corresponding .h file first to make sure the
headers are self-contained. Additionally, this moves some unneeded includes
around.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 20:07:48 +02:00
Gregor Best c2ea920ca0 remove encoding=utf-8 from modelines
This option is no longer valid in modelines, so it has been removed from
all modelines using the following shellscript:

    #!/bin/ksh

    git ls-tree -r HEAD | cut -f2 | while read f; do
        egrep -e '^(//|--) vim: .*encoding=' $f >/dev/null || continue
        sed -E -e '/^(\/\/|--) vim:/s/:encoding=utf-8//' $f > /tmp/foo
        mv /tmp/foo $f
    done

Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-11 17:34:09 +02:00
Uli Schlachter ab3674ec13 luaa: Add "refresh" signal
This signal is emitted whenever awesome finishes the current event loop run.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-15 18:48:07 +02:00
Uli Schlachter 3dbf89c990 Lazyle set the input focus (FS#804)
Instead of immediately setting the X11 input focus when client.focus is assigned
something, we now just remember that we'll have to do something later. The focus
is then set in the next prepare call by libev (= after the current main loop run
is done).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-10 14:57:14 +02:00
Uli Schlachter 742c0dead0 Systray: Fix
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 15:38:44 +02:00
Uli Schlachter 5f5787d97b Wibox: Rename to drawin
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 13:36:02 +02:00
Uli Schlachter d213f19c5f Widgets: Remove
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 13:27:21 +02:00
Uli Schlachter 58bb601658 Stop using most of libxcb-event
Upstream removed most of the code from libxcb-event and there is no
event-related stuff left in this library. We now no longer use any of the parts
that were removed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 17:35:48 +02:00
Daniel Graña f47b816996 Register systray only if systray widgets are attached. (FS#503)
Signed-off-by: Daniel Graña <dangra@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 09:24:36 +02:00
Julien Danjou a20400d60f client: move stack code into stack
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:28:49 +02:00
Julien Danjou e9ef51a521 wibox: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +02:00
Julien Danjou e204473dfc client: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +02:00
Uli Schlachter 33e209dd83 Re-add lazy banning
This kind-of-reverts 058dbab828.

If banning_refresh() is called, only the lua events that it generated before are
now generated (the unfocus event). The actual mapping and unmapping of X11
windows is defered until the end of the main loop via a new per-screen
need_lazy_banning flag.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-28 14:04:59 +02:00
Julien Danjou 058dbab828 banning: remove passive refresh support (FS#629)
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-21 12:18:24 +02:00
Julien Danjou 332e2cb8e8 layout: rename to banning
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-10 11:42:43 +02:00
Julien Danjou f473a107b0 cleanup #includes
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-17 16:52:25 +02:00
Uli Schlachter 2a6d5d207d client_stack(): Only stack windows once per mainloop
I was creating 2000 wiboxes in a loop (don't ask) and creating them took
forever. According to callgrind, there were about 2 million calls to
xcb_configure_window() and most (if not all) of them were from client_stack().
Awesome spent 70% of its cpu time in these client_stack() calls.

client_stack() is O(N^2) on the number of clients (it walks the list of clients
itself twice and each call to client_stack_above() walks the list too) and O(N)
on the number of wiboxes (it walks the wibox list twice). So obviously calls to
it should be rare.

This patch makes client_stack() only set a flag which is later checked. This
should reduce the number of restacks to the bare minimum. With this patch,
neither xcb_configure_window() nor anything else client_stack() related shows
up as having a lot of calls or using much cpu time.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-10 18:15:48 +02:00
Uli Schlachter 4b82608952 Remove the argument to awesome_refresh()
awesome_refresh() had a xcb_connection_t as first argument. Since there is
only one connection to the X server, this argument doesn't really have any
alternatives to globalconf.connection and thus makes no sense.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-10 18:02:49 +02:00
Julien Danjou f4648c2e26 wibox: wibox_refresh merge statusbar and titlebar
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-22 11:11:56 +02:00
Julien Danjou 87a89b6aa1 use xcb_flush; move refresh stuff in common function
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-26 19:35:37 +02:00
Pierre Habouzit 585496b66a Make event handler setup private to the event module.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-26 22:47:56 +02:00
Pierre Habouzit cde80ab49a Move CLEANMASK to xutil.h, remove useless #Includes
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-26 22:47:56 +02:00
Julien Danjou 26738c4dab xshape: remove, nothing prove it's really useful
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-17 15:06:05 +02:00
Julien Danjou 1f046b3c9f [everything] Switch from libconfuse to Lua
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-05-20 18:01:15 +02:00
Arnaud Fontaine dafafd077c Port Awesome to XCB 2008-05-03 12:00:59 +02:00
Julien Danjou 68c14355af [events] Stop handling LeaveNotify events
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-04-03 13:17:33 +02:00
Julien Danjou 680555a317 [bobmarley] Stop grabbing Motion events
That fails in GTK+ apps anyway

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-04-02 11:39:11 +02:00
Julien Danjou bd2f4a212e Move grabkeys() out of event, and move it into window; clean and remove setup() function in awesome.c 2008-03-06 16:18:01 +01:00
Julien Danjou dd9a1b99c4 Rename events functions from handle_event... to event_handle 2008-03-06 09:09:59 +01:00
Julien Danjou de8dcbb724 replace drop_events arch by x,y pointer coordinates saving 2008-03-04 10:14:13 +01:00
Julien Danjou 437bc5c22c add 2008 copyright notice 2008-01-02 16:59:43 +01:00
Julien Danjou 4f65aa8f51 rework headers inclusion 2008-01-01 18:02:36 +01:00
Julien Danjou 87fce96644 add support for NET_CLOSE_WINDOW 2007-12-27 20:49:38 +01:00
Julien Danjou c900e37843 add mouse bindings to status bar 2007-12-27 15:49:00 +01:00
Aldo Cortesi ce556ec743 The preferred line length is 80 characters. 2007-12-18 11:27:26 +01:00
Aldo Cortesi 2f74c079aa Massive, massive interface refactoring.
The big change here is that we now keep our configuration structure in a global
variable called globalconf. This radically simplifies many interfaces, since
passing awesomeconf everywhere is no longer necessary. There are also more
subtle interface effects - now we can reliably identify a screen from just a
screen ID, rather than an awesomeconf, screenid tuple.

Overall, this patch makes most of the interfaces in awesome much nicer to use -
enjoy!

Yes, this is a huge patch, but since a lot of the refactoring was done
systematically using vim macros, splitting this up would have been very hard.
2007-12-16 12:12:48 +01:00
Julien Danjou 5fa67c23df split awesomeconf and screen config
a.k.a the big post-2.0 blind commit
2007-12-11 20:56:51 +01:00
Julien Danjou cfa31c399d introduce mouse.[ch] files and move uicb_mouse*() to them 2007-11-13 22:57:57 +01:00
Julien Danjou 69c235280d resizemouse() is now an uicb function 2007-11-12 14:06:59 +01:00