[mythtv] [patch] show mouse cursor option

Daniel Thor Kristjansson danielk at mrl.nyu.edu
Mon Feb 28 23:45:09 UTC 2005


On Tue, 24 Feb 2004, Isaac Richards wrote:
]Hmm..  Would you instead mind making this get rid of the individual setCursor
]calls, and just not call the setOverrideCursor for the main window?  I think
]that'd work better..

Old patch revisited.

I was pretty busy when I initially sent in the show mouse cursor patch. 
So this got lost in the shuffle.

In case it has been forgotten:
   This is a small patch that adds a "Hide Mouse Cursor" option to the
   second screen in the appearance configuration in the frontend's config
   menu. It defaults to hiding the mouse cursor as it Myth does now. But,
   if you deselect the checkbox, you will see the mouse cursor on all
   screens. This is useful if you run Myth on your main computer screen
   and need to be able to find the mouse cursor.

I've reworked the patch to just use setCursor in MythMainWindow
instead of using setOverrideCursor. I've also added this to
mythui's MythMainWindow. Finally, I moved this code from the
class constructor to the Init function. This means that you
don't have to restart the frontend for a change in mouse
cursor visibility to take effect.

-- Daniel
-------------- next part --------------
Index: libs/libmyth/mythdialogs.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythdialogs.cpp,v
retrieving revision 1.104
diff -u -r1.104 mythdialogs.cpp
--- libs/libmyth/mythdialogs.cpp	23 Feb 2005 05:04:35 -0000	1.104
+++ libs/libmyth/mythdialogs.cpp	28 Feb 2005 23:23:22 -0000
@@ -234,13 +234,10 @@
     RegisterKey("Global", "7", "7", "7");
     RegisterKey("Global", "8", "8", "8");
     RegisterKey("Global", "9", "9", "9");
-
-    qApp->setOverrideCursor(QCursor(Qt::BlankCursor));
 }
 
 MythMainWindow::~MythMainWindow()
 {
-    qApp->restoreOverrideCursor();
     delete d;
 }
 
@@ -258,11 +255,12 @@
     setFixedSize(QSize(d->screenwidth, d->screenheight));
 
     setFont(gContext->GetMediumFont());
-    setCursor(QCursor(Qt::BlankCursor));
 
+    bool hideCursor = gContext->GetNumSetting("HideMouseCursor", 1);
+    setCursor((hideCursor) ? (Qt::BlankCursor) : (Qt::ArrowCursor));
 #ifdef QWS
 #if QT_VERSION >= 0x030300
-    QWSServer::setCursorVisible(false);
+    QWSServer::setCursorVisible(!hideCursor);
 #endif
 #endif
 
@@ -886,7 +884,6 @@
     defaultSmallFont = gContext->GetSmallFont();
 
     setFont(defaultMediumFont);
-    setCursor(QCursor(Qt::BlankCursor));
 
     if (setsize)
     {
@@ -1041,7 +1038,6 @@
     setPalette(parent->palette());
     popupForegroundColor = foregroundColor ();
     setFont(parent->font());
-    setCursor(QCursor(Qt::BlankCursor));
 
     hpadding = gContext->GetNumSetting("PopupHeightPadding", 120);
     wpadding = gContext->GetNumSetting("PopupWidthPadding", 80);
@@ -1070,7 +1066,6 @@
     setFrameStyle(QFrame::Box | QFrame::Plain);
     setPalette(parent->palette());
     setFont(parent->font());
-    setCursor(QCursor(Qt::BlankCursor));
 
     hpadding = gContext->GetNumSetting("PopupHeightPadding", 120);
     wpadding = gContext->GetNumSetting("PopupWidthPadding", 80);
@@ -1412,7 +1407,6 @@
     gContext->GetScreenSettings(screenwidth, wmult, screenheight, hmult);
 
     setFont(gContext->GetMediumFont());
-    setCursor(QCursor(Qt::BlankCursor));
 
     gContext->ThemeWidget(this);
 
Index: libs/libmyth/mythwidgets.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythwidgets.cpp,v
retrieving revision 1.89
diff -u -r1.89 mythwidgets.cpp
--- libs/libmyth/mythwidgets.cpp	31 Jan 2005 19:08:37 -0000	1.89
+++ libs/libmyth/mythwidgets.cpp	28 Feb 2005 23:23:22 -0000
@@ -369,8 +369,6 @@
     //  works across most 3.x.x versions of Qt.
     setTextFormat(Qt::PlainText);    
 
-    setCursor(QCursor(Qt::BlankCursor));
-
     cycle_time = 3000;
 
     pre_cycle_text_upto = "";
Index: libs/libmyth/themedmenu.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/themedmenu.cpp,v
retrieving revision 1.107
diff -u -r1.107 themedmenu.cpp
--- libs/libmyth/themedmenu.cpp	20 Feb 2005 21:01:05 -0000	1.107
+++ libs/libmyth/themedmenu.cpp	28 Feb 2005 23:23:22 -0000
@@ -2176,7 +2176,7 @@
     parent->setFixedSize(QSize(screenwidth, screenheight));
 
     parent->setFont(gContext->GetMediumFont());
-    parent->setCursor(QCursor(Qt::BlankCursor));
+    //parent->setCursor(QCursor(Qt::BlankCursor));
 
     gContext->ThemeWidget(parent);
 
Index: libs/libmythui/mythmainwindow.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythui/mythmainwindow.cpp,v
retrieving revision 1.6
diff -u -r1.6 mythmainwindow.cpp
--- libs/libmythui/mythmainwindow.cpp	20 Feb 2005 21:01:05 -0000	1.6
+++ libs/libmythui/mythmainwindow.cpp	28 Feb 2005 23:23:22 -0000
@@ -229,8 +229,6 @@
     RegisterKey("Global", "8", "8", "8");
     RegisterKey("Global", "9", "9", "9");
 
-    qApp->setOverrideCursor(QCursor(Qt::BlankCursor));
-
     setAutoBufferSwap(false);
 
     d->drawTimer = new QTimer(this);
@@ -244,8 +242,6 @@
 
 MythMainWindow::~MythMainWindow()
 {
-    qApp->restoreOverrideCursor();
-
     while (!d->stackList.isEmpty())
     {
         delete d->stackList.back();
@@ -352,21 +348,21 @@
     setGeometry(d->xbase, d->ybase, d->screenwidth, d->screenheight);
     setFixedSize(QSize(d->screenwidth, d->screenheight));
 
-/*
-    setFont(gContext->GetMediumFont());
-    setCursor(QCursor(Qt::BlankCursor));
-*/
-    setGeometry(100, 100, 800, 600);
-
-    if (d->painter->GetName() != "OpenGL")
-        setFixedSize(QSize(800, 600));
+    //setFont(gContext->GetMediumFont());
 
+    bool hideCursor = gContext->GetNumSetting("HideMouseCursor", 1);
+    setCursor((hideCursor) ? (Qt::BlankCursor) : (Qt::ArrowCursor));
 #ifdef QWS
 #if QT_VERSION >= 0x030300
-    QWSServer::setCursorVisible(false);
+    QWSServer::setCursorVisible(!hideCursor);
 #endif
 #endif
 
+    setGeometry(100, 100, 800, 600);
+
+    if (d->painter->GetName() != "OpenGL")
+        setFixedSize(QSize(800, 600));
+
     WFlags flags = getWFlags();
     flags |= WRepaintNoErase;
 #ifdef QWS
Index: programs/mythfrontend/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/globalsettings.cpp,v
retrieving revision 1.226
diff -u -r1.226 globalsettings.cpp
--- programs/mythfrontend/globalsettings.cpp	23 Feb 2005 05:04:36 -0000	1.226
+++ programs/mythfrontend/globalsettings.cpp	28 Feb 2005 23:23:22 -0000
@@ -1353,6 +1353,15 @@
 };
 #endif
 
+static HostCheckBox *HideMouseCursor() {
+    HostCheckBox *gc = new HostCheckBox("HideMouseCursor");
+    gc->setLabel(QObject::tr("Hide Mouse Cursor in Myth"));
+    gc->setValue(true);
+    gc->setHelpText(QObject::tr("Toggles mouse cursor visibility."));
+    return gc;
+};
+
+
 static HostCheckBox *RunInWindow()
 {
     HostCheckBox *gc = new HostCheckBox("RunFrontendInWindow");
@@ -2939,6 +2948,7 @@
     screen->addChild(GuiOffsetX());
     screen->addChild(GuiOffsetY());
     screen->addChild(GuiSizeForTV());
+    screen->addChild(HideMouseCursor());
     screen->addChild(RunInWindow());
     addChild(screen);
 


More information about the mythtv-dev mailing list