Commit graph

95 commits

Author SHA1 Message Date
John Lindgren
a837fefc80 Adjust views to account for output layout changes
labwc currently doesn't handle output layout changes very well:

 - Windows can end up "lost" completely offscreen
 - Maximized/fullscreen windows can end up spanning multiple outputs

Currently, new_output_notify() and output_destroy_notify() contain logic
to update the cursor and force a repaint when outputs are added or
removed.  This logic in fact needs to run on any output layout change,
so consolidate it into a new function, output_update_for_layout_change().

Then add a second new function, view_adjust_for_layout_change(), which
adjusts window placement to account for the new layout.

The behavior is roughly as follows:

 - Normal windows that end up offscreen are centered on the closest
   output (making use of the existing view_center() logic)
 - Maximized windows are re-maximized on the closest output.  Logic is
   also added to the unmaximize step to check that the original
   unmaximized position is still on-screen.
 - Fullscreen windows are re-fullscreened on the same output if
   possible; otherwise they are un-fullscreened.

Minimized windows don't require any special handling.  Their placement
is adjusted just the same, but invisible to the user until they are
later unminimized.

There is some positioning glitch still with un-fullscreening a window
whose output has been disconnected/disabled; it can end up in an
unexpected position (but at least has the correct size and decoration).
I don't think this is due to a bug in my change per se, but perhaps the
change has exposed a bug elsewhere.

Fixes: #177
2022-01-01 16:20:13 +00:00
John Lindgren
2ce961a0bd Check the return value of wlr_output_layout_get() for NULL
wlr_output_layout_get() seems to return NULL for disabled outputs.

Fixes: #174
2021-12-24 21:08:32 +00:00
ARDiDo
7d68eeb5eb cursor: scale xcursor for all output scales 2021-12-17 10:20:57 -05:00
John Lindgren
4d92391246 Fix graphical artifacts after adding/removing outputs
When an output is added or removed, the position of the other
outputs can also change, resulting in windows moving between them.
We need to redraw all the outputs (not just the new one) to prevent
stale/corrupted screen contents.
2021-11-28 08:32:45 +00:00
John Lindgren
816a61b2fa Fix invisible cursor at startup 2021-11-27 14:31:23 -05:00
Johan Malm
d50c2f2eac Fix minor style violations 2021-11-26 19:27:50 +00:00
John Lindgren
687993370f Enable new outputs (before setting mode)
Fixes the following error with wlroots-git 0.14.0.r391.g585a908a-1:

    [DEBUG] [types/output/output.c:603] Tried to modeset a disabled output
2021-11-26 16:13:58 +00:00
ARDiDo
ed3d0cd523 HiDPI: fix osd placement and maximized scale 2021-11-24 17:33:10 -05:00
Jan Beich
3e5458fa24 server: chase swaywm/wlroots@fdf3169b41
ld: error: undefined symbol: wlr_backend_get_renderer
>>> referenced by output.c
>>>               labwc.p/src_output.c.o:(render_rect)
>>> referenced by output.c
>>>               labwc.p/src_output.c.o:(render_rect)
>>> referenced by output.c
>>>               labwc.p/src_output.c.o:(render_texture)
>>> referenced 5 more times

Based on 5865af75cf
Based on a6538ced35
2021-11-21 07:52:19 +00:00
Johan Malm
b878db57a7 menu: support submenus
Support submenus defined as follows:

<menu id="submenu" label="Submenu">
  <item label="item1.1"></item>
  <item label="item1.2"></item>
</menu>

<menu id="root-menu" label="">
  <menu id="submenu" />
  <item label="item0"></item>
</menu>
2021-11-02 18:31:19 +00:00
ARDiDo
33e55dbc46 output: update layer surfaces on output geometry changes 2021-10-30 16:07:10 +01:00
Johan Malm
c48b9d44d1 config: add <core><adaptiveSync> 2021-10-22 20:23:09 +01:00
Johan Malm
174e82a608 layers: support popups 2021-10-20 22:32:46 +01:00
Joshua Ashton
35e9d8cb35 output: Implement src box for viewporter
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-20 18:49:22 +01:00
Johan Malm
606b6d946e Fix coding style, mostly whitespace 2021-10-15 20:52:36 +01:00
ARDiDo
565f0daee9 drag across monitor 2021-10-03 21:50:29 +01:00
ARDiDo
6bf3bb97f5 implement basic drag and drop 2021-10-03 21:50:29 +01:00
Johan Malm
ebb632419b *.c: add SPDX-License-Identifier 2021-09-24 21:45:48 +01:00
Johan Malm
69e236932e Fix coding style in output.c and xbm/tokenize.c 2021-09-24 20:56:44 +01:00
Johan Malm
cce3c8cda0 src/: fix coding style 2021-09-21 22:05:56 +01:00
Daniel Barlow
75564d6b8d fix madly flashing background
the preprocessor symbol DEBUG is now defined to (0) even
when debugging should not not be enabled, so change from checking
2021-08-29 16:13:36 +01:00
Johan Malm
ea3ea49783 Fix more coding style violations 2021-08-25 20:45:39 +01:00
Johan Malm
645a8e46a6 Support fullscreen mode (issue #53) 2021-08-23 22:05:30 +01:00
Johan Malm
5cf4539827 output: fallback to other output modes if preferred mode fails
See sway@4cdc4ac6

Sometimes the preferred mode is not available due to hardware
constraints. In these cases it is better to fallback to lower modes than
to end up with a black screen.
2021-08-22 14:14:50 +01:00
Johan Malm
5f01c49b72 ssd: refactor and position title nearer left hand edge
Put title deco at the end of linked list to render it on top of corner
edges.
2021-08-22 14:06:11 +01:00
Johan Malm
77ade08158 osd: support 'alt-tab' on screen display
The osd window shows title, app_id/class and shell of all views that can
be cycled between.
2021-08-16 07:16:56 +01:00
Johan Malm
9a9cd609f6 menu: fix breakage caused by f857aea8 2021-08-09 17:28:39 +01:00
Johan Malm
f857aea8f4 ssd: add application title to title bar 2021-08-07 09:35:53 +01:00
Johan Malm
5ecf0e1e7e Make font_texture_create() more generic
Move font_texture_create() to font.c so it can be used for purposes other
than rendering the menu, for example server side decoration.

Refactor menu.c and menu.h to use this more generic font_texture_create()
2021-08-07 08:35:46 +01:00
Johan Malm
82e47ac1f5 Remove src/common/log.c
Use wlr_log() instead
2021-07-23 21:15:55 +01:00
Johan Malm
20fd8f59a7 Remove info() and die() 2021-07-22 21:30:17 +01:00
Johan Malm
22f5073ebd xdg: use "usable_area" when positioning view 2021-07-21 22:04:54 +01:00
Johan Malm
e50bb45890 Move corner textures from ssd.c to theme.c
It makes more sense to just keep one set of corner textures for server
side view decorations, rather than storing a set for each view. This also
keeps the code simpler when when changing theme parameters.
2021-07-16 17:07:00 +01:00
Johan Malm
69f0f68cc2 Open new views on output where cursor is 2021-07-13 21:50:02 +01:00
Johan Malm
a3ac2f2767 layers: take into account usable area when maximizing views 2021-07-12 21:39:09 +01:00
Johan Malm
ee15a5fe56 cursor: handle button press on layer-surface (issue #41) 2021-07-12 16:44:30 +01:00
Johan Malm
238fab1518 output: assert instead of quiet return 2021-06-30 20:12:58 +01:00
Johan Malm
892e93dd84 output: access texture width/height directly
wlr_texture_get_size() is removed in wlroots@6369f709 so we have to
access width and height directly.
2021-05-17 19:55:57 +01:00
Johan Malm
02628bde38 s/LAB_ADAPTIVE_SYNC/LABWC_ADAPTIVE_SYNC/
Use the the prefix LABWC_ for environment variable to increase
consistency.
2021-03-30 22:41:17 +01:00
Johan Malm
fdfb12b2ce Added support for rounded corners 2021-03-27 21:04:12 +00:00
Johan Malm
be27024a2a output: optionally call wlr_output_enable_adaptive_sync()
Set environment variable LAB_ADAPTIVE_SYNC to enable adaptive sync.
2021-03-22 21:25:51 +00:00
Johan Malm
2a48f2801b Create a linked list of SSD for each view 2021-03-21 21:46:16 +00:00
Johan Malm
fc76100fd5 Add ssd.h 2021-03-21 20:54:55 +00:00
Johan Malm
a262b729df Rename deco.c ssd.c 2021-03-20 14:41:39 +00:00
Johan Malm
6737aeabcd output: scale sdd and menu 2021-03-20 14:24:31 +00:00
Jan Beich
ad07acc13c xdg: chase swaywm/wlroots@f574ca934c
src/xdg.c:180:2: warning: implicit declaration of function 'wlr_xdg_surface_for_each_popup' is invalid in C99 [-Wimplicit-function-declaration]
        wlr_xdg_surface_for_each_popup(view->xdg_surface, iterator, data);
        ^
ld: error: undefined symbol: wlr_xdg_surface_for_each_popup
>>> referenced by xdg.c:180 (src/xdg.c:180)
>>>               labwc.p/src_xdg.c.o:(xdg_toplevel_view_for_each_popup)

Based on 5438cc158a
2021-03-13 23:23:33 +00:00
Johan Malm
f842394737 output: simplify render_cycle_box() 2021-03-13 11:20:47 +00:00
Johan Malm
b8c6f9c216 xdg: update padding on commit
Maximize/unmaximize changes padding on XDG-shell views with CSD, so we
need to update padding to render cycle-view decoration correctly.
2021-03-12 21:23:46 +00:00
Johan Malm
c1269adc40 xdg: on init, set maximize according to wlr_xdg_surface status 2021-03-08 21:56:57 +00:00
Johan Malm
83f6618e68 output: set layout-coords coorectly for cycle box 2021-03-08 07:05:47 +00:00