mirror of
https://github.com/labwc/labwc.git
synced 2026-04-07 08:21:20 -04:00
[fixup] move to view_impl_apply_geometry() in view-impl-common.c
This commit is contained in:
parent
b8eca4c41e
commit
485c594142
2 changed files with 27 additions and 28 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
#include "view-impl-common.h"
|
#include "view-impl-common.h"
|
||||||
#include "foreign-toplevel/foreign.h"
|
#include "foreign-toplevel/foreign.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
#include "output.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "window-rules.h"
|
#include "window-rules.h"
|
||||||
|
|
||||||
|
|
@ -74,6 +75,22 @@ resizing_edge(struct view *view, enum lab_edge edge)
|
||||||
&& (server->resize_edges & edge);
|
&& (server->resize_edges & edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
center_fullscreen_view(struct view *view, int w, int h)
|
||||||
|
{
|
||||||
|
int x = 0, y = 0;
|
||||||
|
if (view_compute_centered_position(view, NULL, w, h, &x, &y)) {
|
||||||
|
view_move(view, x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
surface_is_smaller_than_output(struct view *view, int w, int h)
|
||||||
|
{
|
||||||
|
struct wlr_output *output = view->output->wlr_output;
|
||||||
|
return w < output->width || h < output->height;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_impl_apply_geometry(struct view *view, int w, int h)
|
view_impl_apply_geometry(struct view *view, int w, int h)
|
||||||
{
|
{
|
||||||
|
|
@ -118,4 +135,14 @@ view_impl_apply_geometry(struct view *view, int w, int h)
|
||||||
if (!wlr_box_equal(current, &old)) {
|
if (!wlr_box_equal(current, &old)) {
|
||||||
view_moved(view);
|
view_moved(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Centre fullscreen windows if smaller than output, for example Wine
|
||||||
|
* game SWAT4. See issue #2779
|
||||||
|
*/
|
||||||
|
if (view->fullscreen && !view->current.x && !view->current.y) {
|
||||||
|
if (surface_is_smaller_than_output(view, w, h)) {
|
||||||
|
center_fullscreen_view(view, w, h);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
28
src/xdg.c
28
src/xdg.c
|
|
@ -132,24 +132,6 @@ do_late_positioning(struct view *view)
|
||||||
/* TODO: reorder so this forward declaration isn't needed */
|
/* TODO: reorder so this forward declaration isn't needed */
|
||||||
static void set_pending_configure_serial(struct view *view, uint32_t serial);
|
static void set_pending_configure_serial(struct view *view, uint32_t serial);
|
||||||
|
|
||||||
static void
|
|
||||||
center_fullscreen_view(struct view *view, struct wlr_box *size)
|
|
||||||
{
|
|
||||||
int x = 0, y = 0;
|
|
||||||
if (view_compute_centered_position(view, NULL, size->width, size->height, &x, &y)) {
|
|
||||||
view_move(view, x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
|
||||||
surface_is_smaller_than_output(struct view *view, struct wlr_box *size)
|
|
||||||
{
|
|
||||||
struct wlr_output *output = view->output->wlr_output;
|
|
||||||
wlr_log(WLR_ERROR, "output->width=%d, output->height=%d", output->width, output->height);
|
|
||||||
wlr_log(WLR_ERROR, "size->width=%d, size->height=%d", size->width, size->height);
|
|
||||||
return size->width < output->width || size->height < output->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_commit(struct wl_listener *listener, void *data)
|
handle_commit(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -293,16 +275,6 @@ handle_commit(struct wl_listener *listener, void *data)
|
||||||
toplevel->scheduled.height = view->current.height;
|
toplevel->scheduled.height = view->current.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Centre fullscreen windows if smaller than output, for example Wine
|
|
||||||
* game SWAT4. See issue #2779
|
|
||||||
*/
|
|
||||||
if (view->fullscreen && !view->current.x && !view->current.y) {
|
|
||||||
if (surface_is_smaller_than_output(view, &size)) {
|
|
||||||
center_fullscreen_view(view, &size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue