mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
Fix more coding style violations
This commit is contained in:
parent
a9042e3cde
commit
ea3ea49783
5 changed files with 39 additions and 33 deletions
52
src/output.c
52
src/output.c
|
|
@ -18,7 +18,7 @@
|
||||||
#include "ssd.h"
|
#include "ssd.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
|
||||||
//#define DEBUG 1
|
#define DEBUG (0)
|
||||||
|
|
||||||
typedef void (*surface_iterator_func_t)(struct output *output,
|
typedef void (*surface_iterator_func_t)(struct output *output,
|
||||||
struct wlr_surface *surface, struct wlr_box *box,
|
struct wlr_surface *surface, struct wlr_box *box,
|
||||||
|
|
@ -524,7 +524,7 @@ render_deco(struct view *view, struct output *output,
|
||||||
struct wlr_box box = ssd_visible_box(view, type);
|
struct wlr_box box = ssd_visible_box(view, type);
|
||||||
if (isbutton(type) &&
|
if (isbutton(type) &&
|
||||||
wlr_box_contains_point(&box, cur->x, cur->y)) {
|
wlr_box_contains_point(&box, cur->x, cur->y)) {
|
||||||
float *color = (float[4]){ 0.5, 0.5, 0.5, 0.5 };
|
float *color = (float[4]) { 0.5, 0.5, 0.5, 0.5 };
|
||||||
render_rect(output, output_damage, &box, color);
|
render_rect(output, output_damage, &box, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -848,8 +848,8 @@ new_output_notify(struct wl_listener *listener, void *data)
|
||||||
* a black screen. See sway@4cdc4ac6
|
* a black screen. See sway@4cdc4ac6
|
||||||
*/
|
*/
|
||||||
if (!wlr_output_test(wlr_output)) {
|
if (!wlr_output_test(wlr_output)) {
|
||||||
wlr_log(WLR_DEBUG, "preferred mode rejected, falling back to "
|
wlr_log(WLR_DEBUG,
|
||||||
"another mode");
|
"preferred mode rejected, falling back to another mode");
|
||||||
struct wlr_output_mode *mode;
|
struct wlr_output_mode *mode;
|
||||||
wl_list_for_each(mode, &wlr_output->modes, link) {
|
wl_list_for_each(mode, &wlr_output->modes, link) {
|
||||||
if (mode == preferred_mode) {
|
if (mode == preferred_mode) {
|
||||||
|
|
@ -922,7 +922,8 @@ output_init(struct server *server)
|
||||||
output_manager_init(server);
|
output_manager_init(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_config_apply(struct server *server,
|
static void
|
||||||
|
output_config_apply(struct server *server,
|
||||||
struct wlr_output_configuration_v1 *config)
|
struct wlr_output_configuration_v1 *config)
|
||||||
{
|
{
|
||||||
server->pending_output_config = config;
|
server->pending_output_config = config;
|
||||||
|
|
@ -931,18 +932,18 @@ static void output_config_apply(struct server *server,
|
||||||
wl_list_for_each(head, &config->heads, link) {
|
wl_list_for_each(head, &config->heads, link) {
|
||||||
struct wlr_output *o = head->state.output;
|
struct wlr_output *o = head->state.output;
|
||||||
bool need_to_add = head->state.enabled && !o->enabled;
|
bool need_to_add = head->state.enabled && !o->enabled;
|
||||||
if(need_to_add) {
|
if (need_to_add) {
|
||||||
wlr_output_layout_add_auto(server->output_layout, o);
|
wlr_output_layout_add_auto(server->output_layout, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool need_to_remove = !head->state.enabled && o->enabled;
|
bool need_to_remove = !head->state.enabled && o->enabled;
|
||||||
if(need_to_remove) {
|
if (need_to_remove) {
|
||||||
wlr_output_layout_remove(server->output_layout, o);
|
wlr_output_layout_remove(server->output_layout, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_output_enable(o, head->state.enabled);
|
wlr_output_enable(o, head->state.enabled);
|
||||||
if(head->state.enabled){
|
if (head->state.enabled) {
|
||||||
if(head->state.mode){
|
if (head->state.mode) {
|
||||||
wlr_output_set_mode(o, head->state.mode);
|
wlr_output_set_mode(o, head->state.mode);
|
||||||
} else {
|
} else {
|
||||||
int32_t width = head->state.custom_mode.width;
|
int32_t width = head->state.custom_mode.width;
|
||||||
|
|
@ -961,20 +962,22 @@ static void output_config_apply(struct server *server,
|
||||||
server->pending_output_config = NULL;
|
server->pending_output_config = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool verify_output_config_v1(const struct wlr_output_configuration_v1 *config)
|
static bool
|
||||||
|
verify_output_config_v1(const struct wlr_output_configuration_v1 *config)
|
||||||
{
|
{
|
||||||
//TODO implement
|
/* TODO implement */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_output_manager_apply(struct wl_listener *listener, void* data)
|
static void
|
||||||
|
handle_output_manager_apply(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct server *server = wl_container_of(listener, server, output_manager_apply);
|
struct server *server = wl_container_of(listener, server, output_manager_apply);
|
||||||
struct wlr_output_configuration_v1 *config = data;
|
struct wlr_output_configuration_v1 *config = data;
|
||||||
|
|
||||||
bool config_is_good = verify_output_config_v1(config);
|
bool config_is_good = verify_output_config_v1(config);
|
||||||
|
|
||||||
if(config_is_good) {
|
if (config_is_good) {
|
||||||
output_config_apply(server, config);
|
output_config_apply(server, config);
|
||||||
wlr_output_configuration_v1_send_succeeded(config);
|
wlr_output_configuration_v1_send_succeeded(config);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -988,10 +991,11 @@ static void handle_output_manager_apply(struct wl_listener *listener, void* data
|
||||||
* a struct that we send to clients via the wlr_output_configuration v1
|
* a struct that we send to clients via the wlr_output_configuration v1
|
||||||
* interface
|
* interface
|
||||||
*/
|
*/
|
||||||
static struct wlr_output_configuration_v1 *create_output_config(struct server *server)
|
static struct
|
||||||
|
wlr_output_configuration_v1 *create_output_config(struct server *server)
|
||||||
{
|
{
|
||||||
struct wlr_output_configuration_v1 *config = wlr_output_configuration_v1_create();
|
struct wlr_output_configuration_v1 *config = wlr_output_configuration_v1_create();
|
||||||
if(config == NULL) {
|
if (!config) {
|
||||||
wlr_log(WLR_ERROR, "wlr_output_configuration_v1_create()");
|
wlr_log(WLR_ERROR, "wlr_output_configuration_v1_create()");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1001,31 +1005,32 @@ static struct wlr_output_configuration_v1 *create_output_config(struct server *s
|
||||||
struct wlr_output_configuration_head_v1 *head =
|
struct wlr_output_configuration_head_v1 *head =
|
||||||
wlr_output_configuration_head_v1_create(config,
|
wlr_output_configuration_head_v1_create(config,
|
||||||
output->wlr_output);
|
output->wlr_output);
|
||||||
if (head == NULL) {
|
if (!head) {
|
||||||
wlr_log(WLR_ERROR, "wlr_output_configuration_head_v1_create()");
|
wlr_log(WLR_ERROR, "wlr_output_configuration_head_v1_create()");
|
||||||
wlr_output_configuration_v1_destroy(config);
|
wlr_output_configuration_v1_destroy(config);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
struct wlr_box *box = wlr_output_layout_get_box(server->output_layout,
|
struct wlr_box *box = wlr_output_layout_get_box(server->output_layout,
|
||||||
output->wlr_output);
|
output->wlr_output);
|
||||||
if (box != NULL) {
|
if (box) {
|
||||||
head->state.x = box->x;
|
head->state.x = box->x;
|
||||||
head->state.y = box->y;
|
head->state.y = box->y;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_ERROR, "failed to get output layout box");
|
wlr_log(WLR_ERROR, "failed to get output layout box");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_output_layout_change(struct wl_listener *listener, void *data) {
|
static void
|
||||||
|
handle_output_layout_change(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
struct server *server = wl_container_of(listener, server, output_layout_change);
|
struct server *server = wl_container_of(listener, server, output_layout_change);
|
||||||
|
|
||||||
bool done_changing = server->pending_output_config == NULL;
|
bool done_changing = server->pending_output_config == NULL;
|
||||||
if(done_changing) {
|
if (done_changing) {
|
||||||
struct wlr_output_configuration_v1 *config = create_output_config(server);
|
struct wlr_output_configuration_v1 *config = create_output_config(server);
|
||||||
if(config != NULL) {
|
if (config) {
|
||||||
wlr_output_manager_v1_set_configuration(server->output_manager, config);
|
wlr_output_manager_v1_set_configuration(server->output_manager, config);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_ERROR, "wlr_output_manager_v1_set_configuration()");
|
wlr_log(WLR_ERROR, "wlr_output_manager_v1_set_configuration()");
|
||||||
|
|
@ -1033,7 +1038,8 @@ static void handle_output_layout_change(struct wl_listener *listener, void *data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void output_manager_init(struct server *server)
|
void
|
||||||
|
output_manager_init(struct server *server)
|
||||||
{
|
{
|
||||||
server->output_manager = wlr_output_manager_v1_create(server->wl_display);
|
server->output_manager = wlr_output_manager_v1_create(server->wl_display);
|
||||||
|
|
||||||
|
|
@ -1050,7 +1056,7 @@ struct output *
|
||||||
output_from_wlr_output(struct server *server, struct wlr_output *wlr_output)
|
output_from_wlr_output(struct server *server, struct wlr_output *wlr_output)
|
||||||
{
|
{
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &server->outputs, link) {
|
wl_list_for_each (output, &server->outputs, link) {
|
||||||
if (output->wlr_output == wlr_output) {
|
if (output->wlr_output == wlr_output) {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ ssd_box(struct view *view, enum ssd_part_type type)
|
||||||
box.x = view->x - theme->border_width;
|
box.x = view->x - theme->border_width;
|
||||||
box.y = view->y + view->h;
|
box.y = view->y + view->h;
|
||||||
box.width = view->w + 2 * theme->border_width;
|
box.width = view->w + 2 * theme->border_width;
|
||||||
box.height = +theme->border_width + INVISIBLE_MARGIN;
|
box.height = theme->border_width + INVISIBLE_MARGIN;
|
||||||
break;
|
break;
|
||||||
case LAB_SSD_PART_LEFT:
|
case LAB_SSD_PART_LEFT:
|
||||||
box.x = view->x - theme->border_width - INVISIBLE_MARGIN;
|
box.x = view->x - theme->border_width - INVISIBLE_MARGIN;
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ view_center(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_output_layout *layout = view->server->output_layout;
|
struct wlr_output_layout *layout = view->server->output_layout;
|
||||||
struct wlr_output_layout_output* ol_output =
|
struct wlr_output_layout_output *ol_output =
|
||||||
wlr_output_layout_get(layout, wlr_output);
|
wlr_output_layout_get(layout, wlr_output);
|
||||||
int center_x = ol_output->x + wlr_output->width / wlr_output->scale / 2;
|
int center_x = ol_output->x + wlr_output->width / wlr_output->scale / 2;
|
||||||
int center_y = ol_output->y + wlr_output->height / wlr_output->scale / 2;
|
int center_y = ol_output->y + wlr_output->height / wlr_output->scale / 2;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue