Skip to content

Commit 4ce29e6

Browse files
CendioOssmanLMattsson
authored andcommitted
Generate better (fake) modelines
This is what Xwayland does, so let's try to do the same to avoid any incompatibilites with applications. (cherry picked from commit 876cbf0)
1 parent 785577f commit 4ce29e6

File tree

4 files changed

+66
-5
lines changed

4 files changed

+66
-5
lines changed

unix/xserver/hw/vnc/Makefile.am

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AM_CPPFLAGS = \
1212
-I$(TIGERVNC_BUILDDIR) \
1313
-I$(TIGERVNC_SRCDIR)/common \
1414
-I$(TIGERVNC_SRCDIR)/unix/common \
15-
$(DIX_CFLAGS)
15+
$(DIX_CFLAGS) $(LIBXCVT_CFLAGS)
1616

1717
noinst_LTLIBRARIES = libvnccommon.la
1818

@@ -51,7 +51,11 @@ LOCAL_LIBS = \
5151
$(COMMON_LIBS)
5252

5353
Xvnc_DEPENDENCIES = $(LOCAL_LIBS)
54-
Xvnc_LDADD = $(LOCAL_LIBS) $(XSERVER_SYS_LIBS) $(XVNC_SYS_LIBS)
54+
Xvnc_LDADD = \
55+
$(LOCAL_LIBS) \
56+
$(XSERVER_SYS_LIBS) \
57+
$(XVNC_SYS_LIBS) \
58+
$(LIBXCVT_LIBS)
5559

5660
Xvnc_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
5761

unix/xserver/hw/vnc/xvnc.c

+28-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ from the X Consortium.
4141
#include "xorg-version.h"
4242

4343
#include <stdio.h>
44+
#ifdef HAVE_LIBXCVT
45+
#include <libxcvt/libxcvt.h>
46+
#endif
4447
#include <X11/X.h>
4548
#include <X11/Xproto.h>
4649
#include <X11/Xos.h>
@@ -764,13 +767,37 @@ vncRandRModeGet(int width, int height)
764767
RRModePtr mode;
765768

766769
memset(&modeInfo, 0, sizeof(modeInfo));
767-
sprintf(name, "%dx%d", width, height);
768770

771+
#ifdef HAVE_LIBXCVT
772+
struct libxcvt_mode_info *cvtMode;
773+
774+
cvtMode = libxcvt_gen_mode_info(width, height, 60.0, false, false);
775+
776+
modeInfo.width = cvtMode->hdisplay;
777+
modeInfo.height = cvtMode->vdisplay;
778+
modeInfo.dotClock = cvtMode->dot_clock * 1000.0;
779+
modeInfo.hSyncStart = cvtMode->hsync_start;
780+
modeInfo.hSyncEnd = cvtMode->hsync_end;
781+
modeInfo.hTotal = cvtMode->htotal;
782+
modeInfo.vSyncStart = cvtMode->vsync_start;
783+
modeInfo.vSyncEnd = cvtMode->vsync_end;
784+
modeInfo.vTotal = cvtMode->vtotal;
785+
modeInfo.modeFlags = cvtMode->mode_flags;
786+
787+
free(cvtMode);
788+
789+
/* libxcvt rounds up to multiples of 8, so override them here */
790+
modeInfo.width = width;
791+
modeInfo.height = height;
792+
#else
769793
modeInfo.width = width;
770794
modeInfo.height = height;
771795
modeInfo.hTotal = width;
772796
modeInfo.vTotal = height;
773797
modeInfo.dotClock = ((CARD32) width * (CARD32) height * 60);
798+
#endif
799+
800+
sprintf(name, "%dx%d", width, height);
774801
modeInfo.nameLength = strlen(name);
775802
mode = RRModeGet(&modeInfo, name);
776803
if (mode == NULL)

unix/xserver120.patch

+16-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ index 0909cc5b4..c01873200 100644
1010
AC_PROG_LN_S
1111
LT_PREREQ([2.2])
1212
LT_INIT([disable-static win32-dll])
13-
@@ -1735,6 +1736,14 @@ if test "x$XVFB" = xyes; then
13+
@@ -1735,6 +1736,19 @@ if test "x$XVFB" = xyes; then
1414
AC_SUBST([XVFB_SYS_LIBS])
1515
fi
1616

@@ -21,6 +21,11 @@ index 0909cc5b4..c01873200 100644
2121
+PKG_CHECK_MODULES(GBM, "$LIBGBM", [GBM=yes], [GBM=no])
2222
+if test "x$GBM" = xyes; then
2323
+ AC_DEFINE(HAVE_GBM, 1, [Have GBM support])
24+
+fi
25+
+
26+
+PKG_CHECK_MODULES(LIBXCVT, "libxcvt", [XCVT=yes], [XCVT=no])
27+
+if test "x$XCVT" = xyes; then
28+
+ AC_DEFINE(HAVE_LIBXCVT, 1, [Have libxcvt support])
2429
+fi
2530

2631
dnl Xnest DDX
@@ -126,6 +131,16 @@ diff --git a/include/dix-config.h.in b/include/dix-config.h.in
126131
index f8fc67067..d53c4e72f 100644
127132
--- a/include/dix-config.h.in
128133
+++ b/include/dix-config.h.in
134+
@@ -63,6 +63,9 @@
135+
/* Has libunwind support */
136+
#undef HAVE_LIBUNWIND
137+
138+
+/* Have libxcvt support */
139+
+#undef HAVE_LIBXCVT
140+
+
141+
/* Define to 1 if you have the `cbrt' function. */
142+
#undef HAVE_CBRT
143+
129144
@@ -83,6 +83,9 @@
130145
/* Define to 1 if you have the <fcntl.h> header file. */
131146
#undef HAVE_FCNTL_H

unix/xserver21.patch

+16-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ index fad7b5769..2c167de3d 100644
1010
AC_PROG_LN_S
1111
LT_PREREQ([2.2])
1212
LT_INIT([disable-static win32-dll])
13-
@@ -1720,6 +1721,14 @@ if test "x$XVFB" = xyes; then
13+
@@ -1720,6 +1721,19 @@ if test "x$XVFB" = xyes; then
1414
AC_SUBST([XVFB_SYS_LIBS])
1515
fi
1616

@@ -21,6 +21,11 @@ index fad7b5769..2c167de3d 100644
2121
+PKG_CHECK_MODULES(GBM, "$LIBGBM", [GBM=yes], [GBM=no])
2222
+if test "x$GBM" = xyes; then
2323
+ AC_DEFINE(HAVE_GBM, 1, [Have GBM support])
24+
+fi
25+
+
26+
+PKG_CHECK_MODULES(LIBXCVT, "$LIBXCVT", [XCVT=yes], [XCVT=no])
27+
+if test "x$XCVT" = xyes; then
28+
+ AC_DEFINE(HAVE_LIBXCVT, 1, [Have libxcvt support])
2429
+fi
2530

2631
dnl Xnest DDX
@@ -55,6 +60,16 @@ diff --git a/include/dix-config.h.in b/include/dix-config.h.in
5560
index 382d70609..04a4fd263 100644
5661
--- a/include/dix-config.h.in
5762
+++ b/include/dix-config.h.in
63+
@@ -63,6 +63,9 @@
64+
/* Has libunwind support */
65+
#undef HAVE_LIBUNWIND
66+
67+
+/* Have libxcvt support */
68+
+#undef HAVE_LIBXCVT
69+
+
70+
/* Define to 1 if you have the `cbrt' function. */
71+
#undef HAVE_CBRT
72+
5873
@@ -77,6 +77,9 @@
5974
/* Define to 1 if you have the <fcntl.h> header file. */
6075
#undef HAVE_FCNTL_H

0 commit comments

Comments
 (0)