mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-21 04:54:17 +02:00
Apply clang-format
This commit is contained in:
parent
34412aecad
commit
2b84406bbd
5 changed files with 50 additions and 27 deletions
11
keybinding.c
11
keybinding.c
|
|
@ -9,11 +9,11 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
#include <wlr/backend/session.h>
|
||||
#include <wlr/types/wlr_output_damage.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/backend/session.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
|
||||
#include "keybinding.h"
|
||||
#include "message.h"
|
||||
|
|
@ -422,9 +422,9 @@ keybinding_workspace_fullscreen(struct cg_server *server) {
|
|||
|
||||
// Switch to a differerent virtual terminal
|
||||
static int
|
||||
keybinding_switch_vt(struct wlr_backend* backend, unsigned int vt) {
|
||||
keybinding_switch_vt(struct wlr_backend *backend, unsigned int vt) {
|
||||
if(wlr_backend_is_multi(backend)) {
|
||||
struct wlr_session* session = wlr_backend_get_session(backend);
|
||||
struct wlr_session *session = wlr_backend_get_session(backend);
|
||||
if(session) {
|
||||
wlr_session_change_vt(session, vt);
|
||||
}
|
||||
|
|
@ -581,7 +581,8 @@ keybinding_cycle_views(struct cg_server *server, bool reverse) {
|
|||
return;
|
||||
}
|
||||
|
||||
wlr_output_damage_add_box(curr_workspace->output->damage, &curr_workspace->focused_tile->tile);
|
||||
wlr_output_damage_add_box(curr_workspace->output->damage,
|
||||
&curr_workspace->focused_tile->tile);
|
||||
seat_set_focus(server->seat, new_view);
|
||||
/* Move the previous view to the end of the list unless we are focused on
|
||||
* the desktop*/
|
||||
|
|
|
|||
5
seat.c
5
seat.c
|
|
@ -1094,8 +1094,9 @@ seat_set_focus(struct cg_seat *seat, struct cg_view *view) {
|
|||
}
|
||||
|
||||
#if CG_HAS_XWAYLAND
|
||||
if(view->type == CG_XWAYLAND_VIEW && ! xwayland_view_should_manage(view)) {
|
||||
const struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
||||
if(view->type == CG_XWAYLAND_VIEW && !xwayland_view_should_manage(view)) {
|
||||
const struct cg_xwayland_view *xwayland_view =
|
||||
xwayland_view_from_view(view);
|
||||
if(!wlr_xwayland_or_surface_wants_focus(
|
||||
xwayland_view->xwayland_surface)) {
|
||||
return;
|
||||
|
|
|
|||
2
server.h
2
server.h
|
|
@ -17,7 +17,7 @@ struct cg_server {
|
|||
struct wl_event_loop *event_loop;
|
||||
|
||||
struct cg_seat *seat;
|
||||
struct wlr_backend* backend;
|
||||
struct wlr_backend *backend;
|
||||
struct wlr_idle *idle;
|
||||
struct wlr_idle_inhibit_manager_v1 *idle_inhibit_v1;
|
||||
struct wl_listener new_idle_inhibitor_v1;
|
||||
|
|
|
|||
32
view.c
32
view.c
|
|
@ -15,21 +15,21 @@
|
|||
#include <wayland-server-core.h>
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/types/wlr_output_damage.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_surface.h>
|
||||
#include <wlr/types/wlr_output_damage.h>
|
||||
|
||||
#include "output.h"
|
||||
#include "seat.h"
|
||||
#include "server.h"
|
||||
#include "view.h"
|
||||
#include "workspace.h"
|
||||
#include "xdg_shell.h"
|
||||
#include "view.h"
|
||||
#if CG_HAS_XWAYLAND
|
||||
#include "xwayland.h"
|
||||
#endif
|
||||
|
||||
struct cg_view*
|
||||
struct cg_view *
|
||||
view_get_prev_view(struct cg_view *view) {
|
||||
struct cg_view *prev = NULL;
|
||||
|
||||
|
|
@ -230,10 +230,14 @@ view_unmap(struct cg_view *view) {
|
|||
#endif
|
||||
{
|
||||
if(view_is_visible(view)) {
|
||||
struct cg_view* prev = view_get_prev_view(view);
|
||||
struct cg_tile* view_tile = view_get_tile(view);
|
||||
wlr_output_damage_add_box(view_tile->workspace->output->damage, &view_tile->tile);
|
||||
if(view->workspace->server->seat->seat->keyboard_state.focused_surface == NULL || view->workspace->server->seat->seat->keyboard_state.focused_surface == view->wlr_surface) {
|
||||
struct cg_view *prev = view_get_prev_view(view);
|
||||
struct cg_tile *view_tile = view_get_tile(view);
|
||||
wlr_output_damage_add_box(view_tile->workspace->output->damage,
|
||||
&view_tile->tile);
|
||||
if(view->workspace->server->seat->seat->keyboard_state
|
||||
.focused_surface == NULL ||
|
||||
view->workspace->server->seat->seat->keyboard_state
|
||||
.focused_surface == view->wlr_surface) {
|
||||
seat_set_focus(view->workspace->server->seat, prev);
|
||||
} else {
|
||||
view_tile->view = prev;
|
||||
|
|
@ -246,8 +250,12 @@ view_unmap(struct cg_view *view) {
|
|||
#if CG_HAS_XWAYLAND
|
||||
else {
|
||||
view_damage_whole(view);
|
||||
if(view->workspace->server->seat->seat->keyboard_state.focused_surface == NULL || view->workspace->server->seat->seat->keyboard_state.focused_surface == view->wlr_surface) {
|
||||
seat_set_focus(view->workspace->server->seat, view->workspace->server->seat->focused_view);
|
||||
if(view->workspace->server->seat->seat->keyboard_state
|
||||
.focused_surface == NULL ||
|
||||
view->workspace->server->seat->seat->keyboard_state
|
||||
.focused_surface == view->wlr_surface) {
|
||||
seat_set_focus(view->workspace->server->seat,
|
||||
view->workspace->server->seat->focused_view);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -297,13 +305,15 @@ view_map(struct cg_view *view, struct wlr_surface *surface) {
|
|||
|
||||
void
|
||||
view_destroy(struct cg_view *view) {
|
||||
struct cg_output* curr_output = view->workspace->server->curr_output;
|
||||
struct cg_output *curr_output = view->workspace->server->curr_output;
|
||||
if(view->wlr_surface != NULL) {
|
||||
view_unmap(view);
|
||||
}
|
||||
|
||||
view->impl->destroy(view);
|
||||
view_activate(curr_output->workspaces[curr_output->curr_workspace]->focused_tile->view, true);
|
||||
view_activate(curr_output->workspaces[curr_output->curr_workspace]
|
||||
->focused_tile->view,
|
||||
true);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
27
xwayland.c
27
xwayland.c
|
|
@ -11,8 +11,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_output_damage.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/xwayland.h>
|
||||
#include <xcb/xproto.h>
|
||||
|
|
@ -77,24 +77,35 @@ maximize(struct cg_view *view, int width, int height) {
|
|||
struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
|
||||
struct cg_output *output = view->workspace->output;
|
||||
|
||||
struct wlr_box* box = wlr_output_layout_get_box(view->workspace->server->output_layout, view->workspace->output->wlr_output);
|
||||
struct wlr_xwayland_surface_size_hints *hints = xwayland_view->xwayland_surface->size_hints;
|
||||
struct wlr_box *box =
|
||||
wlr_output_layout_get_box(view->workspace->server->output_layout,
|
||||
view->workspace->output->wlr_output);
|
||||
struct wlr_xwayland_surface_size_hints *hints =
|
||||
xwayland_view->xwayland_surface->size_hints;
|
||||
|
||||
if(hints != NULL && hints->flags & PMaxSize) {
|
||||
if(width > hints->max_width) {
|
||||
wlr_output_damage_add_box(output->damage, &(struct wlr_box){.x=view->ox + box->x, .y = view->oy + box->y, .width = width, .height=height});
|
||||
wlr_output_damage_add_box(output->damage,
|
||||
&(struct wlr_box){.x = view->ox + box->x,
|
||||
.y = view->oy + box->y,
|
||||
.width = width,
|
||||
.height = height});
|
||||
width = hints->max_width;
|
||||
}
|
||||
|
||||
if(height > hints->max_height) {
|
||||
wlr_output_damage_add_box(output->damage, &(struct wlr_box){.x=view->ox + box->x, .y = view->oy + box->y, .width = width, .height=height});
|
||||
wlr_output_damage_add_box(output->damage,
|
||||
&(struct wlr_box){.x = view->ox + box->x,
|
||||
.y = view->oy + box->y,
|
||||
.width = width,
|
||||
.height = height});
|
||||
height = hints->max_height;
|
||||
}
|
||||
}
|
||||
|
||||
wlr_xwayland_surface_configure(
|
||||
xwayland_view->xwayland_surface, view->ox + box->x,
|
||||
view->oy + box->y, width, height);
|
||||
wlr_xwayland_surface_configure(xwayland_view->xwayland_surface,
|
||||
view->ox + box->x, view->oy + box->y, width,
|
||||
height);
|
||||
wlr_xwayland_surface_set_maximized(xwayland_view->xwayland_surface, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue