Commit Graph

373 Commits

Author SHA1 Message Date
Uli Schlachter 353872a45f Correctly read a textbox' ellipsize and wrap properties
The old code used the wrong constants which meant we always returned "word" for
wrap and "end" for ellipsize.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 13:58:46 +02:00
Uli Schlachter 87237a197f Get a client's property more intelligently
Previous, there was a round-trip after each request for a property since we
waited for the reply immediately. Instead, it makes a lot more sense to first
send all of the requests and then handle all the replies. This now takes only a
single round-trip for all the properties from client_update_properties().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 13:54:49 +02:00
Uli Schlachter 84526dd630 Select our events on new after the reparent
Together with the previous commit, this makes us not lose clients across
restarts any more.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 13:33:08 +02:00
Uli Schlachter 709619b466 Push the property requests down
Instead of calling each property handler with a property reply, it's now up to
the handlers to request the properties.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 13:04:08 +02:00
Uli Schlachter 2f20494676 Overhaul property handling
For each property we handle, there is now a function which sends a request and
returns the cookie and a second function that takes the cookie and saves the
result in the client_t struct. This should make it possible to improve our
latency later on.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 13:03:16 +02:00
Uli Schlachter 0eb9363533 Clear our event mask in client_unmanage()
This should fix an actual race condition:
- Client unmaps its window (UnmapNotify for awesome)
- Client maps its window (MapRequest for awesome)
- Due to the UnmapNotify: client_unmanage() runs and reparents the window back
  to the root (ReparentNotify)
- Due to the MapRequest: client_manage() runs
- Due to the ReparentNotify: We call client_unmanage() again and now the
  client's window is lost.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:57:47 +02:00
Uli Schlachter c36ee7fea8 client_unmanage: Update WM_STATE later
According to ICCCM, if a client wants to reuse one of its windows, it has to
wait until the WM updated WM_STATE. This means updating WM_STATE should be the
very last thing we do when unmanaging a window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:57:38 +02:00
Uli Schlachter 1f36a3d4de Obey ICCCM 4.1.5 / 4.2.3
When a window is moved, it should be sent a synthetic ConfigureNotify describing
its new position. This also documents why we send a synthetic event if nothing
was changed in response to a ConfigureRequest.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:50 +02:00
Uli Schlachter a5afa009dc Remove a client window's own border
If a client sets its own border on its window, the results look broken. This was
found via xev by Gregor Best, thanks.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:47 +02:00
Uli Schlachter 719c94d67c Avoid some flickering again
The commit which made awesome a reparenting WM broke the fix from 37703948b3.
Fix this again by stacking the frame window correctly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:44 +02:00
Uli Schlachter a311ab0679 Don't destroy client windows in unmanage
When a client is unmanaged, we destroy our frame window. But since the client's
own window was still a child of the frame window, it was destroyed, too. This
commit fixes this by reparenting the client's window back to the root window
first.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:40 +02:00
Uli Schlachter 9fbdecf26c Split up client_getbywin()
This splits up client_getbywin() into two different functions. One of them finds
a client by its frame window, the other checks against the client's own window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:29 +02:00
Uli Schlachter 102063dbbd Turn this into a reparenting WM
Each window is now reparented under a window created by awesome. This window is
NOT visible, this commit should not cause any visible differences. Instead, this
is done to work around problems with X11.

The only alternative would be to ban windows by moving them offscreen which is
ugly in itself and breaks pagers. Doing it like this seems to be the better
solution.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:26 +02:00
Gregor Best 5d0a81c8bf fix some deprecated atom constants
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 21:43:23 +02:00
Uli Schlachter b64c989963 Stop using libxcb-property
libxcb-property will be dropped from xcb-utils in the next release, because
upstream thinks it's not really useful and well-designed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 16:45:56 +02:00
Uli Schlachter e773eecc03 Remove windows from the save set in unmanage
While a window is in the save set, it will automatically be made visible again
when awesome exits/dies. This makes sure that the next window manager will pick
this window up and handle it properly again.

But when a window explicitly asks not to be visible, it doesn't want to be
visible. Even if awesome dies. So we should remove the client's window from the
save set in client_unmanage.

Thanks to anrxc and his xwrits.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-24 19:44:28 +02:00
Uli Schlachter 5bfe0f69d1 Improve aspect size handling
The window is now no longer enlarged to make it fit into its aspect ratio, but
only ever made lower. This was verified with a small test app that sets a min
aspect ratio of 0.5 and max aspect ratio of 2.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 10:32:57 +02:00
Uli Schlachter 528747267a Fix some size hint mixups
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 10:02:06 +02:00
Uli Schlachter 8e5409a2cd Fix a minor ICCCM incompatibility
ICCCM says that the min size should be used for the base size if no base size is
specified. The only exception is when calculating the aspect ratio of the
window, in that case only the "real" base size may be used.

Awesome didn't do this last part before.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 10:00:23 +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
Uli Schlachter 72261c9750 Ignore size hints on fullscreen windows
If a window is fullscreen it is supposed to cover the full screen. Obeying size
hints makes no sense in this case.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-21 17:48:58 +02:00
Uli Schlachter 37703948b3 Avoid some flickering when a new window opens
A new window is by default above all other windows. This means that when we map
it and then *later* move it to the correct place in the stacking order (thanks
to lazy restacking), the window on the top of the stack has to redraw itself.

I noticed this via naughty notifies redrawing themselves after opening a browser
window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-18 14:32:37 +02:00
Uli Schlachter ddedb961d3 Kick out the systray when wiping a wibox
When a wibox is destroyed or detached from a screen, it is wiped to clean up its
resources. This also includes destroying the window which is associated with the
wibox.

The problem here is that if the wibox contains the systray, the systray window
would automatically be destroyed since all childs of a window are destroyed when
said window is destroyed. To fix this, we kick out the systray window before
destroying the wibox' window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-18 10:08:42 +02:00
Uli Schlachter f8c9b6f704 Move wibox_systray_kickout() up
Next commit will need this function and I wanted to make it clearer that no
changes where done to this function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-18 09:53:45 +02:00
Uli Schlachter 711d78b50c textbox: Throw a lua error on invalid markup
Idea by JD, inspired from a patch by farhaven.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-16 19:16:04 +02:00
Uli Schlachter ba518f9381 Read a textbox' text correctly
Previously, querying a textbox' .text property would return the text with all
pango markup stripped.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-16 19:10:41 +02:00
Uli Schlachter 58f79dca8a Add all managed client windows to the safe set
When an application loses its connection to the X11 server, all the windows in
its save-set are saved by reparenting them back to their closest ancestor. Also,
to they are unconditionally mapped. This second property is exactly what we
need: All windows should be in mapped state, else the next window manager which
starts up won't be managing them.

This should fix all bugs where clients where lost due to a restart, yay! :)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-14 21:35:06 +02:00
Uli Schlachter 7b65f068a1 Reorder some code for fullscreening windows
When one sets a client to fullscreen, this is what currently happens:
- lua code: c.fullscreen = true
- The C code emits request::fullscreen without having touched the client's
  fullscreen property yet (c.fullscreen is still false)
- awful.ewmh changes the client's geometry to fullscreen via c:geometry()
- This causes property::geometry to be emitted
- awful.layout reacts on this and causes the screen to be re-arranged, undoing
  the fullscreen geometry set in awful.ewmh
- The C code for c.fullscreen = true continues and actually changes the client's
  fullscreen flag

The result of this is that we get a client which thinks it is fullscreen'd
without actually being that.

Fix this by first changing the client's fullscreen property and then emitting
request::fullscreen. Same thing for maximized_{vertical,horizontal}.

Thanks to Jim Pryor for reporting this bug and helping reproducing it.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-06-18 18:24:05 +02:00
Julien Danjou 61430f860d ewmh: use client signals to update NET_ACTIVE_WINDOW
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:36:35 +02:00
Julien Danjou f4876b5275 ewmh: use signals to update client hints
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:29:34 +02:00
Julien Danjou 38edc58097 client: implements maximized and fullscreen requests with Lua
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:29:29 +02:00
Julien Danjou abd73e4f08 stack: stack_client_* calls stack_windows()
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:29:16 +02:00
Julien Danjou 4ef5e816ec client: remove internal geometry
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:29:11 +02:00
Julien Danjou c94f7b6767 window: import border_width property
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:29:06 +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 ad23a4ca64 fix tag header and order build
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:28:25 +02:00
Julien Danjou 5359e738e8 key: split resolving in keyresolv
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:28:20 +02:00
Julien Danjou 2b5bb2c34c window: add border_color property
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:28:15 +02:00
Julien Danjou cdd888d6cf xwindow: add xwindow_set_border_color helper function
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:28:10 +02:00
Julien Danjou d3c277b8ab window: add buttons support
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:28:05 +02:00
Julien Danjou 62f0e62d5e wibox: don't listen for every button press/release
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:27:56 +02:00
Julien Danjou f7746a198c luaclass: take care of inheritance garbage collection
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:27:49 +02:00
Julien Danjou 92717a0849 window: add strut support
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:27:45 +02:00
Julien Danjou 220d072164 window: import class
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:27:42 +02:00
Julien Danjou fccc451f89 luaclass: add inheritance support
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:27:04 +02:00
Julien Danjou 6a1ce5ce05 Store widgets references as wibox items
This will store the widgets references that the wibox have inside their
environment table, and not in the global registry, avoiding memory leaks.
This should fix FS#771.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:23:57 +02:00
Gregor Best 5987e48385 client: _really_ honor size hints
If c->honor_size_hints is set to false and the client indicates through
its hints that it wants to be fixed size (by setting min and max width
equal), size hints are not ignored due to client_isfixed not taking
honor_size_hints being false into account. This commit fixes that.

Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-03-03 09:18:13 +01:00
Julien Danjou 9c020877dd ewmh: remove _NET_WORKAREA support (FS#732)
This fixes problem with Qt 4.6.
Our implementation cannot be standard, and was not standard, so just
stop using this EWMH crap.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-02-18 10:04:01 +01:00
Uli Schlachter 49ee5cea05 client_focus_update(): Balance the lua stack
There is a push 15 lines before the push that is removed here, but the client
that is pushed there was never popped. Bad.

Fix this by letting luaA_class_emit_signal() do the needed pop for us.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-02-09 19:46:30 +01:00
Julien Danjou c4c15dba97 image: load with image
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-12-14 10:27:28 +01:00
Uli Schlachter a038f7667c image: Use imlib2's image cache
This makes imlib add images loaded from files to its image cache again. That way
we avoid loading the same image again and again (e.g. if you cycle through the
list layouts all the layout icons are loaded).

To not reintroduce FS#651 (fixed in 2dadce9b), we call
imlib_image_set_changes_on_disk(). This causes two stat() calls if the same file
is loaded again to check if the file's timestamps changed which is still less
expensive than loading the whole image again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-12-14 10:23:23 +01:00
Julien Danjou da53940dd9 systray: fix screen number retrieval
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-12-10 10:11:24 +01:00
Uli Schlachter b0e2bf8b95 Fix a invalid pointer crash bug
This changes wibox_t::mouse_over to a proper reference. That way one can't
remove that widget from underneath us which would lead to an unprotected lua error.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-12-02 09:32:51 +01:00
Julien Danjou 320f551a5f wibox: check border width
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-21 10:45:37 +01:00
Uli Schlachter 0194c5daf9 Wibox: Check if a window exists before changing it
wibox_set_border_color() and luaA_wibox_set_border_width() didn't check if a
wibox really had an associated X11 window before changing this window which
resulted in (silent) errors.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-16 15:12:46 +01:00
Julien Danjou 8d36fefd15 image: remove bad usage of globalconf.L
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-10 10:48:23 +01:00
Julien Danjou 1d65b7c55f widget: fix screen number of layouts as arg
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-09 21:27:26 +01:00
Julien Danjou 6ee5122462 client: remove redraw()
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-09 13:02:45 +01:00
Uli Schlachter a44da9fe8e wibox: check if a wibox' window exists before modifying it
If you change the .bg of an existing wibox which isn't attached to any screen
yet, then there is no window for which we can update the XCB_CW_BACK_PIXEL.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-08 11:23:01 +01:00
Uli Schlachter 00092b59bb Set a wibox' bit gravity to NorthWest.
After the last patch, after each resize the X server fills the complete wibox
with its background color which means that the widgets will still flicker. This
patch fixes this by setting the wibox' bit gravity to NorthWest.

This means that if a wibox is enlarged, only the new, larger part will be filled
with the wibox' background color and the rest of the wibox' content will be left
intact. With this patch I couldn't see any flickering anymore.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-08 10:31:10 +01:00
Uli Schlachter 1bb3b07177 wibox: Set a proper back pixel
Currently wiboxes have their background set to "inherit parent pixmap". That
means that each time a wibox is e.g. resized, the X server sets the wibox'
content to the wallpaper and then immediately awesome redraws the wibox with the
proper background. This causes flicker when you e.g. resize clients which have a
titlebar.

With this patch, wiboxes get their proper background color for their "back
pixel" value. Now, instead of showing the wallpaper, the X server will fill the
complete wibox with its background color.

With this patch, the actual widgets will still flicker. Also, if the wibox has a
background image, this image obviously won't be used by the X server and we get
some flicker again. My next patch will address these issues.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-08 10:30:46 +01:00
Julien Danjou 4717feb02b image: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-27 12:16:36 +01:00
Julien Danjou d8c0f516ba luaclass: implement object checking
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-27 12:16:30 +01:00
Lukas Hrazky ec33544896 capi.widget: draw only widgets with numeric index
Signed-off-by: Lukas Hrazky <lukkash@email.cz>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-26 11:07:43 +01:00
Lukas Hrazky f885b8e954 capi.widget: added widget.type getter
Signed-off-by: Lukas Hrazky <lukkash@email.cz>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-26 11:07:43 +01:00
Julien Danjou 3ce7638e0f window: rename to xwindow
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +02:00
Julien Danjou 371ee3e8cc titlebar: remove
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +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 5de485c648 button: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +02:00
Julien Danjou 0672414414 key: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +02:00
Julien Danjou 6fa62a3029 widgets: 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
Julien Danjou 86127a9f49 timer: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:04 +02:00