summaryrefslogtreecommitdiff
path: root/hw/xwayland/xwayland-output.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xwayland/xwayland-output.c')
-rw-r--r--hw/xwayland/xwayland-output.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 7c8ebd49a..dd0d71690 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -30,6 +30,7 @@
#include <X11/Xatom.h>
#include "dix/dix_priv.h"
+#include "dix/input_priv.h"
#include "randr/randrstr_priv.h"
#include "xwayland-cvt.h"
@@ -404,9 +405,18 @@ xwl_output_find_mode(struct xwl_output *xwl_output,
RROutputPtr output = xwl_output->randr_output;
int i;
- /* width & height -1 means we want the actual output mode, which is idx 0 */
- if (width == -1 && height == -1 && output->modes)
- return output->modes[0];
+ /* width & height -1 means we want the actual output mode */
+ if (width == -1 && height == -1) {
+ if (xwl_output->mode_width > 0 && xwl_output->mode_height > 0) {
+ /* If running rootful, use the current mode size to search for the mode */
+ width = xwl_output->mode_width;
+ height = xwl_output->mode_height;
+ }
+ else if (output->modes) {
+ /* else return the mode at first idx 0 */
+ return output->modes[0];
+ }
+ }
for (i = 0; i < output->numModes; i++) {
if (output->modes[i]->mode.width == width && output->modes[i]->mode.height == height)
@@ -900,6 +910,8 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id,
struct xwl_output *xwl_output;
char name[MAX_OUTPUT_NAME] = { 0 };
+ --xwl_screen->expecting_event;
+
xwl_output = calloc(1, sizeof *xwl_output);
if (xwl_output == NULL) {
ErrorF("%s ENOMEM\n", __func__);
@@ -948,7 +960,6 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id,
* use it when binding to the xdg-output protocol...
*/
xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
- --xwl_screen->expecting_event;
if (xwl_screen->xdg_output_manager)
xwl_output_get_xdg_output(xwl_output);
@@ -1187,7 +1198,7 @@ xwl_output_set_transform(struct xwl_output *xwl_output)
}
if (xwl_output->transform == NULL) {
- xwl_output->transform = xnfalloc(sizeof(RRTransformRec));
+ xwl_output->transform = XNFalloc(sizeof(RRTransformRec));
RRTransformInit(xwl_output->transform);
}