mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2024-12-27 21:58:16 +01:00
Initial testing on hidpi clients
This commit is contained in:
parent
0913eff915
commit
61184e3208
4 changed files with 6 additions and 2 deletions
|
@ -34,6 +34,7 @@ struct output_state {
|
||||||
struct wl_output *output;
|
struct wl_output *output;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
|
uint32_t scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xkb {
|
struct xkb {
|
||||||
|
|
|
@ -152,7 +152,7 @@ void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id) {
|
||||||
|
|
||||||
struct output_state *output = bar_output->registry->outputs->items[bar_output->idx];
|
struct output_state *output = bar_output->registry->outputs->items[bar_output->idx];
|
||||||
|
|
||||||
bar_output->window = window_setup(bar_output->registry, output->width, 30, false);
|
bar_output->window = window_setup(bar_output->registry, output->width * output->scale, 30 * output->scale, false);
|
||||||
if (!bar_output->window) {
|
if (!bar_output->window) {
|
||||||
sway_abort("Failed to create window.");
|
sway_abort("Failed to create window.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ static struct buffer *create_buffer(struct window *window, struct buffer *buf,
|
||||||
buf->surface = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, width, height, stride);
|
buf->surface = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, width, height, stride);
|
||||||
buf->cairo = cairo_create(buf->surface);
|
buf->cairo = cairo_create(buf->surface);
|
||||||
buf->pango = pango_cairo_create_context(buf->cairo);
|
buf->pango = pango_cairo_create_context(buf->cairo);
|
||||||
|
pango_cairo_context_set_resolution(buf->pango, 96 * 2);
|
||||||
|
|
||||||
wl_buffer_add_listener(buf->buffer, &buffer_listener, buf);
|
wl_buffer_add_listener(buf->buffer, &buffer_listener, buf);
|
||||||
return buf;
|
return buf;
|
||||||
|
|
|
@ -32,7 +32,8 @@ static void display_handle_done(void *data, struct wl_output *wl_output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void display_handle_scale(void *data, struct wl_output *wl_output, int32_t factor) {
|
static void display_handle_scale(void *data, struct wl_output *wl_output, int32_t factor) {
|
||||||
// this space intentionally left blank
|
struct output_state *state = data;
|
||||||
|
state->scale = factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_output_listener output_listener = {
|
static const struct wl_output_listener output_listener = {
|
||||||
|
@ -220,6 +221,7 @@ static void registry_global(void *data, struct wl_registry *registry,
|
||||||
struct wl_output *output = wl_registry_bind(registry, name, &wl_output_interface, version);
|
struct wl_output *output = wl_registry_bind(registry, name, &wl_output_interface, version);
|
||||||
struct output_state *ostate = malloc(sizeof(struct output_state));
|
struct output_state *ostate = malloc(sizeof(struct output_state));
|
||||||
ostate->output = output;
|
ostate->output = output;
|
||||||
|
ostate->scale = 1;
|
||||||
wl_output_add_listener(output, &output_listener, ostate);
|
wl_output_add_listener(output, &output_listener, ostate);
|
||||||
list_add(reg->outputs, ostate);
|
list_add(reg->outputs, ostate);
|
||||||
} else if (strcmp(interface, desktop_shell_interface.name) == 0) {
|
} else if (strcmp(interface, desktop_shell_interface.name) == 0) {
|
||||||
|
|
Loading…
Reference in a new issue