Infrastructure to go from panel CLI opts all the way to wayland layer shell implementation

This commit is contained in:
Kovid Goyal
2024-03-24 13:58:26 +05:30
parent 56978189e0
commit 333ea519ed
10 changed files with 135 additions and 49 deletions

3
glfw/glfw3.h vendored
View File

@@ -1303,7 +1303,8 @@ typedef struct GLFWLayerShellConfig {
GLFWEdge edge;
const char *output_name;
GLFWFocusPolicy focus_policy;
void (*size_callback)(GLFWwindow *window, const struct GLFWLayerShellConfig *config, float scale, unsigned monitor_width, unsigned monitor_height, uint32_t *width, uint32_t *height);
unsigned size_in_cells;
void (*size_callback)(GLFWwindow *window, const struct GLFWLayerShellConfig *config, unsigned monitor_width, unsigned monitor_height, uint32_t *width, uint32_t *height);
} GLFWLayerShellConfig;
/*! @brief The function pointer type for error callbacks.

11
glfw/wl_window.c vendored
View File

@@ -795,20 +795,17 @@ static void
layer_surface_handle_configure(void* data, struct zwlr_layer_surface_v1* surface, uint32_t serial, uint32_t width, uint32_t height) {
debug("Layer shell configure event: width: %u height: %u\n", width, height);
_GLFWwindow* window = data;
unsigned monitor_width = 0, monitor_height = 0;
if (window->wl.monitorsCount) {
_GLFWmonitor *m = window->wl.monitors[0];
monitor_width = m->currentMode.width; monitor_height = m->currentMode.height;
}
GLFWvidmode m = {0};
if (window->wl.monitorsCount) _glfwPlatformGetVideoMode(window->wl.monitors[0], &m);
window->wl.layer_shell.config.size_callback(
(GLFWwindow*)window, &window->wl.layer_shell.config, _glfwWaylandWindowScale(window), monitor_width, monitor_height,
&width, &height);
(GLFWwindow*)window, &window->wl.layer_shell.config, m.width, m.height, &width, &height);
zwlr_layer_surface_v1_ack_configure(surface, serial);
if ((int)width != window->wl.width || (int)height != window->wl.height) {
debug("Layer shell size changed to %ux%u in layer_surface_handle_configure\n", width, height);
_glfwInputWindowSize(window, width, height);
window->wl.width = width; window->wl.height = height;
resizeFramebuffer(window);
_glfwInputWindowDamage(window);
}
commit_window_surface_if_safe(window);
}