[mythtv] [PATCH] DisplayRes update

John Patrick Poet john at BlueSkyTours.com
Sat Aug 21 16:27:12 EDT 2004


The current DisplayRes mechanism only works well with KDE.  This patch 
allows it to work with other window managers.  Ratpoison still does not 
work, however.

Both QT and X take their cues from the initial "size" of a window, and 
don't handle that window growing very well.  This patch forces the 
initial window "size" to be the maximum possible desired -- it then gets 
resized to the correct size for the situation.

Doug, this also seems to fix that situation where I said that X was 
getting "confused".

John

-------------- next part --------------
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.203
diff -d -u -r1.203 tv_play.cpp
--- libs/libmythtv/tv_play.cpp	19 Aug 2004 02:02:21 -0000	1.203
+++ libs/libmythtv/tv_play.cpp	21 Aug 2004 20:16:26 -0000
@@ -311,23 +311,43 @@
     {
         MythMainWindow *mainWindow = gContext->GetMainWindow();
         bool fullscreen = !gContext->GetNumSetting("GuiSizeForTV", 0);
-        if (fullscreen) 
+        bool switchMode = gContext->GetNumSetting("UseVideoModes", 0);
+
+        if (switchMode)
+        {
+            // For "video playback window" to be as big as 1920x1080
+            // it's parent window "mainWindow", must be at least that big.
+            mainWindow->setGeometry(0, 0, 1920, 1080);
+            mainWindow->setFixedSize(QSize(1920, 1080));
+        }
+        else if (fullscreen) 
         {
             mainWindow->setGeometry(0, 0, QApplication::desktop()->width(),
                                     QApplication::desktop()->height());
             mainWindow->setFixedSize(QSize(QApplication::desktop()->width(),
                                            QApplication::desktop()->height()));
         }
+
         myWindow = new MythDialog(mainWindow, "video playback window");
         myWindow->installEventFilter(this);
         myWindow->setNoErase();
-        if (fullscreen) 
+
+        if (switchMode)
+        {
+            // If switching display resolutions, we may want a resolution
+            // up to 1920x1080.  We have to set that window size here and
+            // now, or some window mananger won't let us grow it later.
+            myWindow->setGeometry(0, 0, 1920, 1080);
+            myWindow->setFixedSize(QSize(1920, 1080));
+        }
+        else if (fullscreen) 
         {
             myWindow->setGeometry(0, 0, QApplication::desktop()->width(),
                                   QApplication::desktop()->height());
             myWindow->setFixedSize(QSize(QApplication::desktop()->width(),
                                          QApplication::desktop()->height()));
         }
+
         myWindow->show();
         myWindow->setBackgroundColor(Qt::black);
         qApp->processEvents();
Index: libs/libmythtv/videoout_xv.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videoout_xv.cpp,v
retrieving revision 1.108
diff -d -u -r1.108 videoout_xv.cpp
--- libs/libmythtv/videoout_xv.cpp	19 Aug 2004 02:02:22 -0000	1.108
+++ libs/libmythtv/videoout_xv.cpp	21 Aug 2004 20:16:26 -0000
@@ -260,17 +260,28 @@
 
     data->XJ_curwin = data->XJ_win = winid;
 
-    if (display_res && display_res->switchToVid(width, height))
+    if (display_res)
     {
-        // Switching to custom display resolution succeeded
-        // Make a note of the new size
-        dispw = display_res->Width();
-        disph = display_res->Height();
-        w_mm = display_res->Width_mm();
-        h_mm = display_res->Height_mm();
+        if (display_res->Width() == 0)
+        {
+            // The very first Resize needs to be the maximum possible
+            // desired res, because X will mask off anything outside
+            // the initial dimensions
+            XMoveResizeWindow(data->XJ_disp, winid, 0, 0, 1920, 1080);
+        }
 
-        // Resize X window to fill new resolution
-        XMoveResizeWindow(data->XJ_disp, winid, 0, 0, dispw, disph);
+        if (display_res->switchToVid(width, height))
+        {
+            // Switching to custom display resolution succeeded
+            // Make a note of the new size
+            dispw = display_res->Width();
+            disph = display_res->Height();
+            w_mm = display_res->Width_mm();
+            h_mm = display_res->Height_mm();
+            
+            // Resize X window to fill new resolution
+            XMoveResizeWindow(data->XJ_disp, winid, 0, 0, dispw, disph);
+        }
     }
     else
     {
Index: libs/libmythtv/videoout_xvmc.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videoout_xvmc.cpp,v
retrieving revision 1.33
diff -d -u -r1.33 videoout_xvmc.cpp
--- libs/libmythtv/videoout_xvmc.cpp	5 Aug 2004 07:35:02 -0000	1.33
+++ libs/libmythtv/videoout_xvmc.cpp	21 Aug 2004 20:16:26 -0000
@@ -269,17 +269,28 @@
 
     data->XJ_curwin = data->XJ_win = winid;
 
-    if (display_res && display_res->switchToVid(width, height))
+    if (display_res)
     {
-        // Switching to custom display resolution succeeded
-        // Make a note of the new size
-        dispw = display_res->Width();
-        disph = display_res->Height();
-        w_mm = display_res->Width_mm();
-        h_mm = display_res->Height_mm();
+        if (display_res->Width() == 0)
+        {
+            // The very first Resize needs to be the maximum possible
+            // desired res, because X will mask off anything outside
+            // the initial dimensions
+            XMoveResizeWindow(data->XJ_disp, winid, 0, 0, 1920, 1080);
+        }
 
-        // Resize X window to fill new resolution
-       XMoveResizeWindow(data->XJ_disp, winid, 0, 0, dispw, disph);
+        if (display_res->switchToVid(width, height))
+        {
+            // Switching to custom display resolution succeeded
+            // Make a note of the new size
+            dispw = display_res->Width();
+            disph = display_res->Height();
+            w_mm = display_res->Width_mm();
+            h_mm = display_res->Height_mm();
+            
+            // Resize X window to fill new resolution
+            XMoveResizeWindow(data->XJ_disp, winid, 0, 0, dispw, disph);
+        }
     }
     else
     {


More information about the mythtv-dev mailing list