aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-06-25 15:30:51 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-06-25 15:30:51 +0000
commit32e70263f905ee58ba4026d57b1a5fec35c26352 (patch)
tree245132d0e20384aaf791099a915783587b426cad
parentsixel: wip: split up image being overwritten, rather than erasing it (diff)
wayland: use xdg_output's description if there's no 'model'
-rw-r--r--wayland.c10
-rw-r--r--wayland.h7
2 files changed, 13 insertions, 4 deletions
diff --git a/wayland.c b/wayland.c
index 5f99a309..ae7ead36 100644
--- a/wayland.c
+++ b/wayland.c
@@ -259,13 +259,15 @@ xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output,
const char *name)
{
struct monitor *mon = data;
- mon->name = strdup(name);
+ mon->name = name != NULL ? strdup(name) : NULL;
}
static void
xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg_output,
const char *description)
{
+ struct monitor *mon = data;
+ mon->description = description != NULL ? strdup(description) : NULL;
}
static const struct zxdg_output_v1_listener xdg_output_listener = {
@@ -666,13 +668,14 @@ handle_global(void *data, struct wl_registry *registry,
static void
monitor_destroy(struct monitor *mon)
{
- free(mon->name);
if (mon->xdg != NULL)
zxdg_output_v1_destroy(mon->xdg);
if (mon->output != NULL)
wl_output_destroy(mon->output);
free(mon->make);
free(mon->model);
+ free(mon->name);
+ free(mon->description);
}
static void
@@ -842,7 +845,8 @@ wayl_init(const struct config *conf, struct fdm *fdm)
"%s: %dx%d+%dx%d@%dHz %s %.2f\" scale=%d PPI=%dx%d (physical) PPI=%dx%d (logical)",
it->item.name, it->item.dim.px_real.width, it->item.dim.px_real.height,
it->item.x, it->item.y, (int)round(it->item.refresh),
- it->item.model, it->item.inch, it->item.scale,
+ it->item.model != NULL ? it->item.model : it->item.description,
+ it->item.inch, it->item.scale,
it->item.ppi.real.x, it->item.ppi.real.y,
it->item.ppi.scaled.x, it->item.ppi.scaled.y);
}
diff --git a/wayland.h b/wayland.h
index 60f39454..ccc03ad3 100644
--- a/wayland.h
+++ b/wayland.h
@@ -19,7 +19,6 @@ struct monitor {
struct wayland *wayl;
struct wl_output *output;
struct zxdg_output_v1 *xdg;
- char *name;
uint32_t wl_name;
int x;
@@ -63,8 +62,14 @@ struct monitor {
float refresh;
enum wl_output_subpixel subpixel;
+ /* From wl_output */
char *make;
char *model;
+
+ /* From xdg_output */
+ char *name;
+ char *description;
+
float inch; /* e.g. 24" */
};