Commit Graph

356 Commits

Author SHA1 Message Date
Kazunobu Kuriyama 4db998fdf2 Accept keysym/unicode symbols on keys
This is an enhancement to make non-ASCII symbol keys usable for
implementation and configuration of Awesome.

The enhancement was proposed and had been developed under the
initiative of Daniel Hahler.  Thanks to his sharing of his results with our
community, we gradually deepened our understanding on the issue.  This
commit is the fruit his enthusiasm spawned.

Closes https://github.com/awesomeWM/awesome/pull/538.
2015-10-26 23:00:15 +01:00
Uli Schlachter 532ec0cd90 Grab client keys on the client window (#496)
Before this, we grabbed the keys on the frame window. That meant we only got key
events for things that nothing else grabbed directly on the key window.

After this, we grab directly on the client window itself and so we "fight" with
everything else which wants to grab keys. I don't actually know how the winner
is decided... First come, first serve, the rest gets an error?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-16 17:30:46 +02:00
Uli Schlachter 085bc00a24 Emit property::geometry only if something changed
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-14 19:40:18 +02:00
Uli Schlachter 438a10973b Add property::geometry to drawin/drawable [#411]
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-14 19:39:27 +02:00
Daniel Hahler 555ccc15a8 doc: typos/grammar 2015-10-14 16:24:52 +02:00
Daniel Hahler 2932322775 doc: params for request::activate 2015-10-14 16:24:51 +02:00
Daniel Hahler e7663e1ebd Some doc fixes 2015-10-14 13:57:38 +02:00
Daniel Hahler 208db47b2d Merge pull request #505 from psychon/fix_window_gravities
Fix window gravities
2015-10-13 11:34:37 +02:00
Uli Schlachter 79fa6ad017 Fix client_apply_size_hints()
The bit that indicates that the base size is set is
XCB_ICCCM_SIZE_HINT_BASE_SIZE. However, instead this code checked
XCB_ICCCM_SIZE_HINT_P_SIZE which is set to indicate how the initial window
position is chosen. So we were checking the complete wrong bit. Whoops...

Fixes: https://github.com/awesomeWM/awesome/issues/456

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 21:13:40 +02:00
Uli Schlachter d4168f3c36 screen_getbycoord: Change definition of 'closest screen'
Instead of comparing only the top-left corner of the screen to the provided
coordinate, this now compares the screen in a more intuitive way, e.g.
coordinates inside of the screen have a distance of zero.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 20:10:23 +02:00
Uli Schlachter 22305f3abf Merge branch 'client_resize_do-prefer-current' of https://github.com/blueyed/awesome 2015-10-10 19:57:45 +02:00
Uli Schlachter b2aaefd095 Apply window gravity for border width changes
Together with the previous changes, this also fixes the initial positions for
metacity's test-gravity.c.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 17:45:24 +02:00
Uli Schlachter 3b97d1c1a7 Apply window gravity for titlebar resizes
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 17:44:11 +02:00
Uli Schlachter 2f78ec5b30 Never explicitly focus the root window
Whenever client.focus == nil, we set the input focus to the root window to
express "nothing has the input focus". However, thanks to the way X11 input
works, this means that whatever is under the mouse cursor gets keyboard input
events. This can easily be reproduced with urxvt and some small addition to the
config to unfocus things.

This commit changes things. Instead of focusing the root window, we create a
special "no focus" window that gets focused if we want nothing to have the
focus.

Closes https://github.com/awesomeWM/awesome/pull/470.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-28 23:36:23 +02:00
Uli Schlachter a5a106f97f Make it possible for Lua to emulate arbitrary properties
This makes it possible to add something similar to a __index / __newindex
metamethod to all our C objects. Based on this, Lua can then easily implement
arbitrary properties on our capi objects.
2015-09-27 17:43:41 +02:00
Daniel Hahler 5431b18f33 Rename client_maybevisible to client_on_selected_tags
This makes it more clear what it is about, and also fixes its
documentation.
2015-09-25 00:43:52 +02:00
Daniel Hahler 62622f7935 Do not unset max/fullscreen when setting the other
From http://standards.freedesktop.org/wm-spec/latest/ar01s05.html:

> _NET_WM_STATE_FULLSCREEN indicates that the window should fill the
> entire screen and have no window decorations. Additionally the Window
> Manager is responsible for restoring the original geometry after a
> switch from fullscreen back to normal window. For example, a
> presentation program would use this hint.

awesome prefers fullscreen internally already.  With this patch, the
previous maximized state will be restored after leaving fullscreen mode.

Fixes https://github.com/awesomeWM/awesome/issues/245.
Closes https://github.com/awesomeWM/awesome/pull/418.
2015-09-02 22:10:56 +02: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
Daniel Hahler 178f479d15 drawin.c: check for integer for x, y, width, height
This adds luaA_getopt_integer, luaA_optinteger and luaA_checkinteger.

Lua 5.2 does not have support for this, but it would be available in Lua
5.3.

Closes https://github.com/awesomeWM/awesome/pull/320.
2015-08-12 14:07:22 +02:00
Daniel Hahler baeb8fd2b5 client_resize_do: remove honor_hints argument
This was only used by client_resize before, which now handles this
itself.

Ref: https://github.com/awesomeWM/awesome/pull/383#commitcomment-12483405.
2015-08-04 20:50:49 +02:00
Daniel Hahler 56d9e3b9de client_resize: apply size hints before calling client_resize_do
This will skip calling `client_resize_do` in case of honored size hints.

This could be also done in `client_resize_do`, but it appears to be
meant to force the resize.

Closes https://github.com/awesomeWM/awesome/pull/383.
2015-08-04 20:50:41 +02:00
Daniel Hahler 1118ec4439 Do not call `xcb_ungrab_key` twice (before `xwindow_grabkeys`)
It gets called in `xwindow_grabkeys` always:

    xwindow_grabkeys(xcb_window_t win, key_array_t *keys)
    {
        /* Ungrab everything first */
        xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, win, XCB_BUTTON_MASK_ANY);

Closes https://github.com/awesomeWM/awesome/pull/366.
2015-08-01 14:16:06 +02:00
Daniel Hahler d5e365804c screen_client_moveto: only emit property::screen if it changed
While debugging #331, I have noticed that the call to `client_resize`
might have changed the screen (and emitted the signal) already, via
a call to `screen_client_moveto` with `doresize=False`.

Closes https://github.com/awesomeWM/awesome/pull/332.
2015-07-26 00:49:35 +02:00
Daniel Hahler 6d323e7c04 doc: distinguish between client.object and client.class
Instead of `client.client`, the client object is now referred to as
`client.object` and the client class as `client.class`.

This moves the documentation of `client.focus` to the class.

Closes https://github.com/awesomeWM/awesome/pull/349.
2015-07-26 00:45:38 +02:00
Daniel Hahler 27fb170744 screen_getbycoord: fallback to nearest screen
This removes the handling of negative x/y from `screen_coord_in_screen`,
which was added in 0f840d2e and does not make sense in
screen_coord_in_screen.

Ref: 50982fc082 (commitcomment-12358053).
Ref: https://github.com/awesomeWM/awesome/pull/331.
2015-07-25 20:12:45 +02:00
Daniel Hahler 0c55b2edec client.get: add `stacked` argument
Fixes https://github.com/awesomeWM/awesome/issues/178.
2015-07-25 18:55:36 +02:00
Daniel Hahler 9dad4f59a4 doc: remove references to Zaphod mode
This has been removed a long time ago (in 32d9a5b).
2015-07-24 15:22:03 +02:00
Daniel Hahler 50982fc082 client_resize_do: prefer client's current screen
In case of an overlapping screen configuration, prefer the client's
current screen.

Without this, clients would be moved to the first matching screen.
2015-07-21 15:16:37 +02:00
Daniel Hahler d5cf6e0272 Add client.first_tag, as a shortcut for `c:tags()[1]`
This is meant to be a faster alternative in case only the first tag is
relevant/used.

Closes https://github.com/awesomeWM/awesome/pull/294.
2015-07-14 01:20:39 +02:00
Daniel Hahler 94814c7512 screen_client_moveto: add comment/whitespace for 'emit signal' 2015-07-12 17:42:53 +02:00
Daniel Hahler 63b19efef8 doc: signals: minor improvements, mainly for "tagged" 2015-07-07 17:19:41 +02:00
Julian Wollrath 26f15a13f3 Document C API directly in the C source code
v2: Add available signals to the docs.

Signed-off-by: Julian Wollrath <jwollrath@web.de>
2015-06-19 23:13:31 +02:00
Uli Schlachter d2f583d839 Screen __index: Don't turn argument into a string
Calling lua_tostring() on a number/integer, turns that stack slot into a string.
This patch changes the code to only call lua_tostring() if the function argument
really is a string.

This partly also caused https://github.com/awesomeWM/awesome/issues/238.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-06-13 11:18:47 +02:00
Uli Schlachter 9555c2d4a6 Emit property::focusable where needed
Before this, doing c.focusable = nil didn't emit this signal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-06-12 11:00:19 +02:00
Daniel Hahler 84d764f3ba Merge pull request #227 from petoju/master
Support for XKB - changing keyboard layouts

Closes https://github.com/awesomeWM/awesome/pull/227
2015-06-10 17:52:24 +02:00
Peter Junos e2562227ab Less reloading of keymap, fixes from psychon comments
Response to psychon comments in PR#227 -
https://github.com/awesomeWM/awesome/pull/227

With this commit, we don't reload keymap, when we are not
notified about its change.
2015-05-28 23:20:17 +02:00
Peter Junos 19137a55c3 Support for XKB - changing keyboard layouts
This commit adds support for writing in prompt (<Super>+R by default)
while different keymap is selected

Signed-off-by: Peter Júnoš <petoju@gmail.com>
2015-05-28 23:20:17 +02:00
Emmanuel Lepage Vallee e8fb93d2b6 lua: Use pushinteger for int type
Attempt to fix #238
2015-05-26 01:09:12 -04:00
Daniel Hahler fd6ffb1458 Make client.focusable writable from Lua
It uses an extra boolean to track if `c.focusable` has been set.

It's possible to unset the overriding by setting it to `nil`, i.e.
`client.focus.focusable = nil`.

Fixes https://github.com/awesomeWM/awesome/issues/237.
Closes https://github.com/awesomeWM/awesome/pull/239.
2015-05-25 15:35:49 +02:00
Uli Schlachter df173f7ddd Make client.focus = nil work (Closes #164)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-14 09:06:12 +01:00
Uli Schlachter 20ca989333 Ignore more events while minimizing a client
When minimizing a client, we temporarily ignore events for the client window (so
that we don't get the UnmapNotify event that we are causing for the unmap) and
for the root window (I don't actually know why, no "harmful" events should be
caused...).

However, we weren't ignoring events on the frame window itself. This commit
fixes that oversight.

The problem here is that the pointer could be inside the window that is being
minimized. When we then unmap said window, the pointer will now be inside of the
frame window and the X11 server will thus generate an EnterNotify. When we
handle this event later on, we emit mouse::enter on the client and e.g. the
default config then focuses this client, which undoes the minimization.

This fixes a regression introduced in commit 3aeac3870c and fixes #92.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-02-25 21:52:03 +01:00
Daniel Hahler d1984a7a1f Merge pull request #95 from blueyed/signal-client-property-screen-old
Send old_screen with "property::screen" client signal
2015-02-20 23:25:38 +01:00
Daniel Hahler 5140ef1764 Send old_screen with "property::screen" client signal
This should improve layout re-arranging with 2+ screens.
2015-02-15 13:26:46 +01:00
Daniel Hahler 8531fef0d3 Merge pull request #119 from psychon/apply_size_hints
Add c:apply_size_hints() to client objects
2015-02-15 01:47:25 +01:00
Daniel Hahler f2aa8d39ed Merge branch 'ewmh_urgent_v1'
- Fix / revert changing of file modes for: lib/awful/tag.lua.in,
   lib/awful/widget/taglist.lua.in, objects/client.c and property.h.
 - Fix typo / punctuation in doc.
 - Use `capi.client.connect_signal` instead of `add_signal`
   (Ref: https://github.com/Elv13/awesome-1/commit/b292b09#commitcomment-9750466).

Pull request: https://github.com/awesomeWM/awesome/pull/33
2015-02-14 23:36:26 +01:00
Daniel Hahler 6183d8587a Merge pull request #118 from blueyed/fix-proper-activate-via-rules
Properly fix activating an "invisible" client via rules
2015-02-14 20:55:04 +01:00
Daniel Hahler e510799a7c Add support for setting client.name
Fixes: https://awesome.naquadah.org/bugs/index.php?do=details&task_id=921
2015-02-14 16:07:09 +01:00
Uli Schlachter 5d7d3fa6ce Add c:apply_size_hints() to client objects
This function gets a width and height of a client, applies the client's size
hints to these numbers and returns the result.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-02-14 15:12:46 +01:00
Daniel Hahler 2174b80c3f client_focus_update: allow "invisible" clients
This removes the check for `client_maybevisible`, which now allows for
`client.focus = c` from Lua for clients that do not are assigned to a
tag yet.
2015-02-14 14:39:26 +01:00
Emmanuel Lepage Vallee d688ebe6cd Add new request::urgent signal
This fix two things:

(1) Clients asking to be urgent while focussed, this have been reported
a few time for urxvt and I usually link a patch that fix this. This may
not be considered a bug by some, but I think it is.

(2) Add the ability to stop noisy clients from setting the urgent state
themselves.
2015-02-10 19:27:46 +00:00
Daniel Hahler dea5a23eac Remove urgent state for already focused client
- Remove urgent state in `client_focus_update` always.
- Make `client_focus_update` indicate if focus changed and use this from
`client_focus` to update `globalconf.focus.need_update`.

Fixes: https://awesome.naquadah.org/bugs/index.php?do=details&task_id=1310
2015-01-10 20:57:49 +01:00
Uli Schlachter 3aeac3870c Unmap minimized clients
Because ICCCM pretty much mandates that minimized (aka "iconic") clients are
unmapped. In detail: To go back to normal state, the client should map its
window and for this to work, the window needs to be unmapped.

Thanks to Oleg Shparber for reporting some issue he had with a self-written Qt
program and for providing a simple and short test case.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-10 00:04:11 +01:00
Uli Schlachter 30b313f77a Implement icon_pixmap and icon_mask from WM_HINTS (FS#1297)
Fun fact: ICCCM specifies that icon_pixmap must have depth 1. Xterm uses a
pixmap with depth 24. Yay... As such, I don't have any test for the depth == 1
case and will just assume that it does the right thing. If it doesn't, I bet no
one will notice anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-07 14:16:17 +01:00
Uli Schlachter 8eed5e7bcf client: Include c.name in the result of tostring(c)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 18:16:05 +01:00
Uli Schlachter 94e61ec94b timer: Move from C to lua as gears.timer
No API-change (besides the obvious no-longer-a-global-object) intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 16:44:04 +01:00
Uli Schlachter e5120e1bec Hide globalconf.L
Everything that needs the lua_State should create a local variable like this:

  lua_State *L = globalconf_get_lua_State();

This ensures that the compiler warns if there are two variables with name "L" in
scope. The idea here is that it should become harder to accidentally use the
global lua state instead of the state of the current state.

While writing this commit, I found another place that gets its wrong: Reading
client.focus from a coroutine was broken, since it was returning the result on
the main thread instead of the current one.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 11:56:58 +01:00
Uli Schlachter da15317ac2 tag_client: Add explicit lua_State argument
tag_client() said that it refers to the tag ontop of the lua stack. However, it
implicitly used globalconf.L as its stack. So if you tagged a client with a tag
from a coroutine, thinks would Go Wrong (tm). Fix this by adding an explicit
lua_State* argument.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 11:14:59 +01:00
Uli Schlachter d668268591 Fix some more dubious uses of globalconf.L
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 11:07:20 +01:00
Uli Schlachter 4cfea189f0 drawin: Use the correct lua_State for the stack index
This just pushed the drawin onto the stack L, but then tries to access it via
globalconf.L. This just calls for problems...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 10:55:21 +01:00
Uli Schlachter f957764e52 drawable/drawin: Pass both lua_State and stack index around
A stack index without the corresponding lua_State pointer is useless, because it
could reference another coroutine than the main thread and thus just assuming
globalconf.L is wrong. Fix this by also passing around the corresponding
lua_State pointer.

This improves the result for the following test:

  coroutine.resume(coroutine.create(function()
      drawin({}).visible = true
  end))

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 10:46:45 +01:00
Uli Schlachter daeb9aee19 Add signals for titlebar resizes (FS#1233)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-10-18 21:41:38 +02:00
Uli Schlachter d76e20bbce drawin_update_drawing: Remove optimization for invisible drawins
This fixes the following code:

   local d = drawin({})
   d.visible = true

The drawin now has a cairo surface assigned

   d.visible = false
   d.width = 1234
   d.visible = true

The width change while the drawin was not visible would not get propagated to
the drawable because of the code that this patch removes. The expectation was
that drawin_map() would update the drawable later.

However, because the drawin was already visible, its drawable also already has
a surface assigned. Thus, drawin_map() wouldn't update the drawable either.

Fix this by just removing this optimizations.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-10-11 13:27:29 +02:00
Uli Schlachter 70fef83e50 drawin: Don't special-case moves
The code in drawin_moveresize() tries to be clever and only updates the drawing
state of the drawable when it is resized, not when it is moved around. This used
to be necessary because once upon a time, drawin_update_drawing() threw away all
of the drawing state and thus forcing a repaint. These days it just calls
drawable_set_geometry() as well and that function special-cases moves.

So this old code in drawin_moveresize() is no longer necessary and actually
caused problems.

These problems occurred because drawin_update_drawing() is being clever and
doesn't do anything for .visible = false drawins, because their drawing state
will be updated once they become visible. However, not skipping
drawable_set_geometry() means that this broke, because drawin_map() thought that
the drawing state was up to date while in reality it wasn't.

References: http://article.gmane.org/gmane.comp.window-managers.awesome/10852
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-10-11 13:12:57 +02:00
Uli Schlachter 14c4dcc969 screen: Fix output deletion
The screen_output_t* that is passed to screen_output_wipe() points into the
middle of the output array table and is a pointer that we never allocated.
Instead, what we want to free here is the name of the output.

Thanks to luzie for reporting this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-31 13:17:34 +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
Uli Schlachter 76bbf61201 drawin: Remove dead code
The only caller for drawin_unref_simplified() is in ARRAY_FUNCS() and here it is
only used in the implementation of drawin_array_wipe(). However, this function
is unused and thus we don't need drawin_unref_simplified() either.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 18:08:21 +02:00
Uli Schlachter fed199eee5 Also allow screen objects were screen indices are expected
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 17:55:42 +02:00
Uli Schlachter 271f084735 screen: Turn into proper lua object
This makes the screen objects use our existing infrastructure for implementing
classes and objects with lua instead of hand-rolling an own version.

This results in some small API change: Screen objects no longer have an
add_signal() function and instead this function exists on the parent screen
class.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 16:37:19 +02:00
Uli Schlachter d8b73de739 screen.[ch]: Move into objects/
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 15:12:47 +02:00
Uli Schlachter 03fec2b0f5 Don't set a background-pixel for our client frame windows
Previously we would get a short black flicker when a client closes. This
happened because first the client's window would get hidden and only a short
moment later would awesome react to this and close its own window. In the mean
time, the X server filled the frame window with its background-pixel which was
black.

Just removing the background-pixel means we get the default value which is None.
This means that the content will be left untouched and the client's window will
be visible for a moment longer.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 14:58:03 +02:00
Uli Schlachter 163fc18ab8 Ignore enter/leave events when unmanaging a window (FS#1239)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-28 13:15:24 +01:00
Uli Schlachter e13d848914 drawin: Correctly add property::shape_* signals
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 22:43:30 +01:00
Uli Schlachter 2869cdc860 window: Factor out helper functions for xproperties
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 18:09:32 +01:00
Uli Schlachter 7c3702e60a Fixup indentation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 16:34:35 +01:00
Uli Schlachter 86f3b7f11f Drawable: Ignore exposes when we have nothing to draw
The X11 server tells us about things that need to be redrawn via expose events.
When we get such an expose event before lua drew the drawable, we just fill the
exposed area with old data (which is black for newly-created drawables).

Fix this by tracking if we have any usable data in a drawable's double buffering
pixmap. This flag is unset whenever we throw away the old content (e.g. due to a
resize) and is set when lua gave us some new content to display.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 16:27:10 +01:00
Uli Schlachter 873358a0b8 EWMH: Handle _NET_WM_DESKTOP in lua
We now handle all "important" EWMH messages in lua and lua can decide to do
different things than the current obvious one.

Consistency!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 16:15:20 +01:00
Uli Schlachter fed803a6bc client manage signal: Remove startup argument
We now have awesome.startup which does the same thing in better.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 20:15:02 +01:00
Uli Schlachter 794318c1a0 drawable: Add pixmap member
Previously, ownership of the pixmaps that we are using for double buffering was
a little weird. The pixmap belonged to the drawin/titlebar, but the
corresponding cairo surface was owned by the drawable. Clean this up by moving
the pixmap to the drawable.

This cleans up lots of ugly code and also fixes a crash: When a drawable was
garbage collected before its drawin, drawin_wipe() would crash accessing the
drawable. This was needed to make it forget about the cairo surface we gave to
it for the pixmap that is being destroyed.

By moving the pixmap to the drawable, this whole issues goes away.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 17:08:36 +01:00
Uli Schlachter 1da87eca3c Fix cairo surface memory leak
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 16:06:18 +01:00
Uli Schlachter 6b8bd49c0b Redraw titlebars more intelligently
Whenever a titlebar of a client needed to be refreshed, all (possibly) four
titlebars would get completely refreshed. So if someone actually added more than
one titlebar to a client, awesome would copy each titlebar's content to the
window four times. Fix this by introducing more fine-grined functions for
uploads.

This also makes awesome only update the affected area when it gets an expose
event for a titlebar instead of all four titlebars completely.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 15:29:11 +01:00
Uli Schlachter 346034c6b6 drawin: Don't unconditionally redraw when made visible
Before this commit, we always threw away the drawin's cairo surface whenever it
was made visible and thus forced a redraw.

This commit changes this so that we only force a redraw if the drawin was
resized why it wasn't visible. To remember when this happens, we free the
drawin's cairo surface without allocating a new one when the drawin is resized
while not being visible. Thus, we then only have to allocate a new surface if
the drawin doesn't have one when it is being made visible.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 09:11:00 +01:00
Uli Schlachter a82b15d805 drawin: Inline drawin_init() into its only caller
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 08:56:55 +01:00
Emmanuel Lepage Vallee d6e06450d3 Add end to end support for spawning tracking using startup notifications
This allow to spawn something, then apply some properties or rules when
the client show up ("manage").

This commit add:
 * "startup_id" property for all clients object (immutable, can be nil)
 * Second return value to awful.util.spawn() with the startup_id
 * Update the documentation

Example:

  local wait_for_it = {}

  local pid,snid = awful.util.spawn("urxvtc")
  wait_for_it[snid] = {ontop=true,sticky=false,
     tag = awful.tag.gettags(mouse.screen)[1] }

  client.connect_signal("manage", function (c, startup)
     if c.startup_id and wait_for_it[c.startup_id] then
        for k,v in pairs(wait_for_it[c.startup_id]) do
           c[k] = v
        end
        if wait_for_it[c.startup_id].tag then
           c:tags({wait_for_it[c.startup_id].tag})
        end
     end
  end)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-15 23:14:02 +01:00
Uli Schlachter ef27189ffe Client: Add (and use) visualtype member to client_t objects
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-15 11:56:57 +01:00
Daniel Hahler a15e53deec Minor doc fixes 2014-03-15 08:52:14 +01:00
Daniel Hahler ac45dc9f59 Add client.maximized (a shortcut for ~_horizontal and ~_vertical)
This also adds the signals `property::maximized`.

Signed-off-by: Daniel Hahler <git@thequod.de>
2014-03-15 08:49:43 +01:00
Daniel Hahler c855b1babb Do not raise clients in client_manage
Instead, use stack_client_push and emit the `request::activate` signal
from awful.rules.apply, if the client gets focus.

Signed-off-by: Daniel Hahler <git@thequod.de>
2014-03-12 16:01:01 +01:00
Uli Schlachter 642ab35988 xproperty: Don't limit property lengths
All that I can say is "oops, I blame copy&paste".

Thanks to Elv13 for noticing this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-09 20:22:44 +01:00
Uli Schlachter 2ac95b4ae8 Fix handling of _NET_CURRENT_DESKTOP messages (FS#1219,FS#1217)
Instead of having the C code mess with which tags are selected, we now emit a
signal on the tag that says that something requested it to be selected. Lua can
then handle this by only switching tags on the correct monitor and by updating
the focus history correctly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-08 15:33:34 +01:00
Uli Schlachter 1b21dce46c Revert "client: Add c.blob property"
This reverts commit a54636751b.

We now have the new xproperty API which does the same thing in a much nicer way.
Thanks to Elv13 for the idea!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-07 16:21:11 +01:00
Uli Schlachter 62e2dee4ba Add awesome.register_xproperty (FS#1212)
This commits adds awesome.register_xproperty(). This allows lua code to register
arbitrary X11 properties with awesome which will then watch these properties.
Whenever such a property is changed on a client or drawin, we will emit the
xproperty::name signal.

This also adds window:get_xproperty(name) and window:set_xproperty(name, value)
which allows to mess with properties.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-07 16:17:40 +01:00
Uli Schlachter 910cbe401d client: Emit property::screen after geometry
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-06 18:08:21 +01:00
Uli Schlachter 04dee81d13 client: Add request::activate signal (FS#848)
When we receive a _NET_ACTIVE_WINDOW request on the root window, we used to just
focus and raise the window. This didn't do much for clients which are on
non-selected tags.

Thus, this commit makes awesome emit request::activate on the client instead.
This is used in awful.ewmh to implement the old behavior again, but with
additionally marking the client as urgent if it isn't visible.

People who don't like this behavior can use client.disconnect_signal to disable
this behavior again. To make this really possible, awful.ewmh becomes a
"non-nil" module.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-06 17:47:55 +01:00
Uli Schlachter a54636751b client: Add c.blob property
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-02-23 12:26:13 +01:00
Uli Schlachter 56c5797905 Finish C-side support for window shapes (FS#1051)
A drawin's and a client's bounding and clip shape can now be queried and is
returned as a cairo surface.  Also, a client window's shape (e.g. xeyes setting
its own shape) can be queried via c.shape_client_bounding and
c.shape_client_clip.  All of these properties now emit signals when changed.

(This also silently fixes a bug in luaA_drawin_set_shape_bounding() which forgot
to include the drawin's border in its size calculation)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-01-03 17:01:43 +01:00
Uli Schlachter db167ebe80 Revert "client: Don't move clients around across restarts (FS#1159)"
This reverts commit c3bca6ac34.

This caused problems where clients would always spawn on the top-left screen and
couldn't be moved around. This was because lua placed them on the other screen,
but when the titlebar got added, their top-left corner was moved over again.
2013-10-06 10:22:49 +02:00
Uli Schlachter c3bca6ac34 client: Don't move clients around across restarts (FS#1159)
This kind of forces every client to have a window gravity of "static".

This fixes most of the problem of clients moving around across restarts due to
the titlebar. What is left is that they move due to the border width which
should be handled in another patch. Also, another patch should make this honor
the client's actual window gravity.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 16:12:06 +02:00
David Mohr e858163a0f Revert "client: add a limit to the loop (FS#573)"
This reverts commit b8de5f2d43.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 14:17:57 +02:00
Uli Schlachter aaa771f887 Switch from libXcursor to libxcb-cursor
Thanks to Michael Stapelberg, there is now a xcb-only port of libXcursor which
does everything we need. This patch switches awesome over to that new library.

Since the only reason for using XOpenDisplay() instead of xcb_connect() was so
that we can use libXcursor, we can get back to that older state again. This
means that this effectively reverts the following commits:

531f8b415c "Added initial support for Xlib cursor themes"
77243cd09a "Add x11-xcb to the pkg-config checks"
779d43fc46 "Don't let Xlib own the event queue"
03759b4847 "Fix keyboard layouts"

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-19 16:48:10 +02:00
Uli Schlachter bcea1aab66 Stop linking against xcb-image
Since the previous commit we don't use this library any more.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-16 12:12:16 +02:00