2021-11-15 22:05:12 +00:00
|
|
|
/*
|
|
|
|
WaylandServer - Output Handling
|
|
|
|
|
|
|
|
Copyright (C) 2020 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
|
|
|
|
Date: November 2021
|
|
|
|
|
|
|
|
This file is part of the GNU Objective C Backend Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2021-10-25 11:16:22 +00:00
|
|
|
#include "wayland/WaylandServer.h"
|
|
|
|
|
|
|
|
static void
|
2021-11-15 22:05:12 +00:00
|
|
|
handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
|
|
|
|
int physical_width, int physical_height, int subpixel,
|
|
|
|
const char *make, const char *model, int transform)
|
2021-10-25 11:16:22 +00:00
|
|
|
{
|
2021-11-15 22:05:12 +00:00
|
|
|
NSDebugLog(@"handle_geometry");
|
|
|
|
struct output *output = data;
|
2021-10-25 11:16:22 +00:00
|
|
|
|
2021-11-15 22:05:12 +00:00
|
|
|
output->alloc_x = x;
|
|
|
|
output->alloc_y = y;
|
|
|
|
output->transform = transform;
|
2021-10-25 11:16:22 +00:00
|
|
|
|
2021-11-15 22:05:12 +00:00
|
|
|
if (output->make)
|
|
|
|
free(output->make);
|
|
|
|
output->make = strdup(make);
|
2021-10-25 11:16:22 +00:00
|
|
|
|
2021-11-15 22:05:12 +00:00
|
|
|
if (output->model)
|
|
|
|
free(output->model);
|
|
|
|
output->model = strdup(model);
|
2021-10-25 11:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-11-15 22:05:12 +00:00
|
|
|
handle_done(void *data, struct wl_output *wl_output)
|
2021-10-25 11:16:22 +00:00
|
|
|
{
|
2021-11-15 22:05:12 +00:00
|
|
|
NSDebugLog(@"handle_done");
|
2021-10-25 11:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-11-15 22:05:12 +00:00
|
|
|
handle_scale(void *data, struct wl_output *wl_output, int32_t scale)
|
2021-10-25 11:16:22 +00:00
|
|
|
{
|
2021-11-15 22:05:12 +00:00
|
|
|
NSDebugLog(@"handle_scale");
|
|
|
|
struct output *output = data;
|
2021-10-25 11:16:22 +00:00
|
|
|
|
2021-11-15 22:05:12 +00:00
|
|
|
output->scale = scale;
|
2021-10-25 11:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2021-11-15 22:05:12 +00:00
|
|
|
handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int width,
|
|
|
|
int height, int refresh)
|
2021-10-25 11:16:22 +00:00
|
|
|
{
|
2021-11-15 22:05:12 +00:00
|
|
|
NSDebugLog(@"handle_mode");
|
|
|
|
struct output *output = data;
|
2021-10-25 11:16:22 +00:00
|
|
|
|
2021-11-15 22:05:12 +00:00
|
|
|
if (flags & WL_OUTPUT_MODE_CURRENT)
|
|
|
|
{
|
|
|
|
output->width = width;
|
|
|
|
output->height = height /*- 30*/;
|
|
|
|
NSDebugLog(@"handle_mode output=%dx%d", width, height);
|
2021-10-25 11:16:22 +00:00
|
|
|
|
2021-11-15 22:05:12 +00:00
|
|
|
// XXX - Should we implement this?
|
|
|
|
// if (display->output_configure_handler)
|
|
|
|
// (*display->output_configure_handler)
|
|
|
|
// (output, display->user_data);
|
|
|
|
//
|
2021-10-25 11:16:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-15 22:05:12 +00:00
|
|
|
const struct wl_output_listener output_listener
|
|
|
|
= {handle_geometry, handle_mode, handle_done, handle_scale};
|