Commit graph

148 commits

Author SHA1 Message Date
bi4k8
58f5e8d16a factor keyboard/cursor cleanup into own functions 2022-01-01 19:24:27 +00:00
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
Joshua Ashton
d5532ace7a xwayland: Implement request_activate
Used by Steam, for example, on the Friends and Chat button.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-31 07:36:25 +00:00
Joshua Ashton
2d98179b31 xdg: Implement request_minimize
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-31 07:36:25 +00:00
Johan Malm
34a12b3515 Fix coding style 2021-12-26 23:29:01 +00:00
Johan Malm
6651d45ed4 cursor: add cursor_update_focus()
...and call it from desktop_move_to_front() in order force an enter event
on the surface below the cursor when cycling views.

Inspired by PR #164 - just restructured it a bit.

Suggested-by: @bi4k8
2021-12-26 22:09:41 +00:00
Consolatis
80f012602f Implement foreign toplevel close 2021-12-23 09:29:08 -05:00
Johan Malm
238062a859 desktop: rename functions to increase consistency
...from
- desktop_raise_view()
- desktop_move_view_to_end_of_cycle()

to
- desktop_move_to_front()
- desktop_move_to_back()
2021-12-06 21:23:49 +00:00
bi4k8
7b7178ebfa move windows to back of cycle when they are minimized 2021-12-06 09:59:06 -05:00
Joshua Ashton
d568c60003 action: If we have a view that is an activator, use that instead of the current focus window
If we don't switch focus, we want the close button to close the window associated with it, not the current focus window.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-03 18:13:30 +00:00
Joshua Ashton
3e973c92ab interactive: Fix crash if a window is destroyed while moving it
Need to clean this up if it's our grabbed window!

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-12-03 18:11:31 +00:00
bi4k8
0be4625c1c implement foreign toplevel activate 2021-12-03 06:43:34 +00:00
bi4k8
031ced85ef implement Resize as an action
this requires action() to know the resize edges to use, so thread them through
2021-12-01 22:45:20 +00:00
Johan Malm
afa299c080 cursor.c: rebase cursor when exiting interactive mode
cursor_rebase() sets the cursor icon and sends a motion-event to the
surface below the cursor. It is made public in anticipation of using it
in various view_* functions.
2021-11-28 22:14:23 +00:00
Johan Malm
1c831bc051 interactive.c: set move/resize cursor
Fixes issue #124
2021-11-28 21:47:24 +00:00
Johan Malm
d50c2f2eac Fix minor style violations 2021-11-26 19:27:50 +00:00
Johan Malm
bca57213a0 Remove min/max macros
...and replace with a local MAX macro, because:

- They contain a ({}) construct which is a GNU extension and that's
  against Drew's coding style
- min() is not used anyway
- MAX() clashes with cairo's macro, so best to not add this in labwc.h
2021-11-26 19:16:00 +00:00
John Lindgren
c01d1f124c Basic support for Move action
- Add Move as a default mouse binding for a Titlebar Press action
- Remove the hard-coded handling in cursor_button()

Example config snippet:

    <mouse>
      <context name="Titlebar">
        <mousebind button="Left" action="Press">
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Move"/>
        </mousebind>
      </context>
    </mouse>
2021-11-26 18:25:04 +00:00
ARDiDo
6698ca7300 HiDPI: send enter and leave events to views when switching monitors 2021-11-24 17:33:10 -05:00
ARDiDo
1d92404108 HiDPI: send output_enter events to views when they open 2021-11-24 17:33:10 -05:00
ARDiDo
aa9720f627 Add support for basic idle and idle inhibitor protocols 2021-11-22 21:58:07 +00: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
Dima Krasner
04450b5e4d build: fix name collision with wlroots, when linking statically 2021-11-08 19:10:37 +00:00
ARDiDo
91a9f1dec9 resistance: remove bool, add resistance.h + license 2021-10-26 21:15:13 +01:00
ARDiDo
4d5b4be608 resistance: improve readability 2021-10-26 21:15:13 +01:00
ARDiDo
ac58ab10a7 resize resistance support 2021-10-26 21:15:13 +01:00
ARDiDo
a24e17dea7 Improve expandibility 2021-10-26 21:15:13 +01:00
Joshua Ashton
0a7f1b51f7 xwayland: Implement set_decorations
Fixes games going between borderless and normal windowed modes.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-20 18:49:02 +01:00
Joshua Ashton
89f09567f5 xdg-deco: Respect decoration requests properly
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-20 18:49:02 +01:00
Johan Malm
806fdb08bd view: add view_get_string_prop() 2021-10-18 20:01:10 +01:00
Joshua Ashton
846ccb9eb9 action: Implement shift to go backwards in OSD
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-18 17:28:34 +01:00
ARDiDo
f5072151a9 add pointer constraints 2021-10-17 22:32:25 +01:00
Joshua Ashton
a6e1ee0a25 include: Add min/max helpers
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-17 19:49:05 +01:00
Joshua Ashton
8652f97887 view: Add view_min_size helper function
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-17 19:49:05 +01:00
Joshua Ashton
8e3108c032 action: Add 'SnapToEdge'
Implements snap-style edge snapping that works between multiple monitors.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-10-17 12:19:35 +01:00
Johan Malm
e2ae63a7cf xdg/wayland-shell: handle set_app_id and set_class events 2021-10-16 21:50:56 +01:00
Johan Malm
e140682528 view: call wlr_foreign_toplevel_handle_v1_set_app_id() on map
Fix issue #74

Add view-impl.c with view_impl_map() containing common code for xdg-shell
and xwayland-shell.
2021-10-16 21:26:57 +01:00
Johan Malm
4d44659c08 desktop: remove deprecated functions
- set_activated()
- desktop_set_focus_view_only()
2021-10-16 19:53:00 +01:00
Johan Malm
9a290feeea desktop: simplify interface for view raise/focus
Split desktop_focus_view() into the following two functions:
  - desktop_focus_and_activate_view()
  - desktop_raise_view()

Always call view_set_activated() rather than using the private
set_activated(). This keeps the code cleaner and ensures
wlr_foreign_toplevel_handle_v1_set_activated() is called.
2021-10-16 19:44:54 +01:00
Johan Malm
70144ac113 view: add view_set_activated()
Call wlr_foreign_toplevel_handle_v1_set_activated() from it in support of
issue #73
2021-10-16 19:24:26 +01:00
Johan Malm
597650b457 theme: add window_(in)active_label_text_color
Support both active and inactive colors for titlebar text
2021-10-15 21:35:41 +01:00
ARDiDo
d4e1791c88 Reconfigure inputs 2021-10-10 21:52:40 +01:00
Johan Malm
6a00166cff Merge branch 'master' of https://github.com/johanmalm/labwc 2021-10-04 06:24:34 +01:00
ARDiDo
6bf3bb97f5 implement basic drag and drop 2021-10-03 21:50:29 +01:00
Johan Malm
1e4598cdce s/desktop_view_at()/desktop_surface_and_view_at()/
Make is clearer what the function does.
2021-09-25 10:04:37 +01:00
Johan Malm
b5addb62e0 labwc.h: fix coding style 2021-09-22 20:24:02 +01:00
Johan Malm
119ef87373 s/focused_view()/desktop_focused_view() 2021-09-20 22:12:34 +01:00
Johan Malm
e4b51fc5e8 desktop.c: make topmost_mapped_view() private 2021-09-20 22:07:19 +01:00
bi4k8
815cd4aa46 define focused_view function and use it for keyboard actions 2021-09-20 21:14:24 +01:00
bi4k8
b7cce58f56 implement ToggleDecorations and ToggleFullscreen actions 2021-09-20 21:14:24 +01:00