Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 580165 Details for
Bug 809019
Impress thinks a machine with 2 monitors in clone mode is multihead
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
a shot at this (does not work :-)
0001-count-mirrored-monitors-as-one.patch (text/plain), 9.71 KB, created by
David Tardon
on 2012-04-25 13:12:48 UTC
(
hide
)
Description:
a shot at this (does not work :-)
Filename:
MIME Type:
Creator:
David Tardon
Created:
2012-04-25 13:12:48 UTC
Size:
9.71 KB
patch
obsolete
>From a64f305cb5a2691119b5381254d433c6b87bc314 Mon Sep 17 00:00:00 2001 >From: David Tardon <dtardon@redhat.com> >Date: Wed, 25 Apr 2012 15:08:53 +0200 >Subject: [PATCH] count mirrored monitors as one > >--- > vcl/inc/unx/gtk/gtkdata.hxx | 2 + > vcl/inc/unx/gtk/gtksys.hxx | 10 +++- > vcl/unx/gtk/app/gtkdata.cxx | 2 + > vcl/unx/gtk/app/gtksys.cxx | 83 ++++++++++++++++++++++++++++++-------- > vcl/unx/gtk/window/gtkframe.cxx | 4 +- > 5 files changed, 78 insertions(+), 23 deletions(-) > >diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx >index 63b8ae3..033bf1a 100644 >--- a/vcl/inc/unx/gtk/gtkdata.hxx >+++ b/vcl/inc/unx/gtk/gtkdata.hxx >@@ -151,6 +151,8 @@ public: > GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; } > bool IsX11Display() const { return m_bX11Display; } > >+ GtkSalSystem* getSystem() const { return m_pSys; } >+ > virtual void deregisterFrame( SalFrame* pFrame ); > GdkCursor *getCursor( PointerStyle ePointerStyle ); > virtual int CaptureMouse( SalFrame* pFrame ); >diff --git a/vcl/inc/unx/gtk/gtksys.hxx b/vcl/inc/unx/gtk/gtksys.hxx >index df9e79e..76ef505 100644 >--- a/vcl/inc/unx/gtk/gtksys.hxx >+++ b/vcl/inc/unx/gtk/gtksys.hxx >@@ -36,7 +36,10 @@ > > class GtkSalSystem : public SalGenericSystem > { >+ typedef std::deque<std::pair<GdkScreen*, int> > ScreenMonitors_t; >+ > GdkDisplay *mpDisplay; >+ ScreenMonitors_t maScreenMonitors; > public: > GtkSalSystem(); > virtual ~GtkSalSystem(); >@@ -56,10 +59,11 @@ public: > { return getXScreenFromDisplayScreen( GetDisplayDefaultScreen() ); } > int GetDisplayXScreenCount(); > SalX11Screen getXScreenFromDisplayScreen(unsigned int nDisplayScreen); >+ void countScreenMonitors(); > // We have a 'screen' number that is combined from screen-idx + monitor-idx >- static int getScreenIdxFromPtr (GdkDisplay *pDisplay, GdkScreen *pScreen); >- static int getScreenMonitorIdx (GdkDisplay *pDisplay, GdkScreen *pScreen, int nX, int nY); >- static GdkScreen *getScreenMonitorFromIdx (GdkDisplay *pDisplay, int nIdx, gint &nMonitor); >+ int getScreenIdxFromPtr (GdkScreen *pScreen); >+ int getScreenMonitorIdx (GdkScreen *pScreen, int nX, int nY); >+ GdkScreen *getScreenMonitorFromIdx (int nIdx, gint &nMonitor); > }; > > #endif // _VCL_GTKSYS_HXX_ >diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx >index 776313b..1961e4a 100644 >--- a/vcl/unx/gtk/app/gtkdata.cxx >+++ b/vcl/unx/gtk/app/gtkdata.cxx >@@ -197,12 +197,14 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event, > > void GtkSalDisplay::screenSizeChanged( GdkScreen* pScreen ) > { >+ m_pSys->countScreenMonitors(); > if (pScreen) > emitDisplayChanged(); > } > > void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) > { >+ m_pSys->countScreenMonitors(); > if (pScreen) > emitDisplayChanged(); > } >diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx >index 3927dbf..6ca7a53 100644 >--- a/vcl/unx/gtk/app/gtksys.cxx >+++ b/vcl/unx/gtk/app/gtksys.cxx >@@ -49,6 +49,7 @@ SalSystem *GtkInstance::CreateSalSystem() > GtkSalSystem::GtkSalSystem() : SalGenericSystem() > { > mpDisplay = gdk_display_get_default(); >+ countScreenMonitors(); > } > > GtkSalSystem::~GtkSalSystem() >@@ -61,6 +62,51 @@ GtkSalSystem::GetDisplayXScreenCount() > return gdk_display_get_n_screens (mpDisplay); > } > >+namespace >+{ >+ >+struct GdkRectangleEqual >+{ >+ bool operator()(GdkRectangle const& rLeft, GdkRectangle const& rRight) >+ { >+ return >+ rLeft.x == rRight.x >+ && rLeft.y == rRight.y >+ && rLeft.width == rRight.width >+ && rLeft.height == rRight.height >+ ; >+ } >+}; >+ >+} >+ >+void >+GtkSalSystem::countScreenMonitors() >+{ >+ maScreenMonitors.clear(); >+ for (gint i = 0; i < gdk_display_get_n_screens(mpDisplay); i++) >+ { >+ GdkScreen* const pScreen(gdk_display_get_screen(mpDisplay, i)); >+ gint nMonitors(pScreen ? gdk_screen_get_n_monitors(pScreen) : 0); >+ if (nMonitors > 1) >+ { >+ std::vector<GdkRectangle> aGeometries; >+ aGeometries.reserve(nMonitors); >+ for (gint j(0); j != nMonitors; ++j) >+ { >+ GdkRectangle aGeometry; >+ gdk_screen_get_monitor_geometry(pScreen, j, &aGeometry); >+ aGeometries.push_back(aGeometry); >+ } >+ GdkRectangleEqual aCmp; >+ std::sort(aGeometries.begin(), aGeometries.end(), aCmp); >+ std::unique(aGeometries.begin(), aGeometries.end(), aCmp); >+ nMonitors = aGeometries.size(); >+ } >+ maScreenMonitors.push_back(std::make_pair(pScreen, nMonitors)); >+ } >+} >+ > // Including gdkx.h kills us with the Window / XWindow conflict > extern "C" { > GType gdk_x11_display_get_type (void); >@@ -73,7 +119,7 @@ GtkSalSystem::getXScreenFromDisplayScreen(unsigned int nScreen) > gint nMonitor; > GdkScreen *pScreen = NULL; > >- pScreen = getScreenMonitorFromIdx (mpDisplay, nScreen, nMonitor); >+ pScreen = getScreenMonitorFromIdx (nScreen, nMonitor); > if (!pScreen) > return SalX11Screen (0); > #if GTK_CHECK_VERSION(3,0,0) >@@ -84,16 +130,16 @@ GtkSalSystem::getXScreenFromDisplayScreen(unsigned int nScreen) > } > > GdkScreen * >-GtkSalSystem::getScreenMonitorFromIdx (GdkDisplay *pDisplay, int nIdx, gint &nMonitor) >+GtkSalSystem::getScreenMonitorFromIdx (int nIdx, gint &nMonitor) > { > GdkScreen *pScreen = NULL; >- for (gint i = 0; i < gdk_display_get_n_screens (pDisplay); i++) >+ for (ScreenMonitors_t::const_iterator aIt(maScreenMonitors.begin()), aEnd(maScreenMonitors.end()); aIt != aEnd; ++aIt) > { >- pScreen = gdk_display_get_screen (pDisplay, i); >+ pScreen = aIt->first; > if (!pScreen) > break; >- if (nIdx > gdk_screen_get_n_monitors (pScreen)) >- nIdx -= gdk_screen_get_n_monitors (pScreen); >+ if (nIdx > aIt->second) >+ nIdx -= aIt->second; > else > break; > } >@@ -102,32 +148,33 @@ GtkSalSystem::getScreenMonitorFromIdx (GdkDisplay *pDisplay, int nIdx, gint &nMo > } > > int >-GtkSalSystem::getScreenIdxFromPtr (GdkDisplay *pDisplay, GdkScreen *pScreen) >+GtkSalSystem::getScreenIdxFromPtr (GdkScreen *pScreen) > { > int nIdx = 0; >- for (gint i = 0; i < gdk_display_get_n_screens (pDisplay); i++) >+ for (ScreenMonitors_t::const_iterator aIt(maScreenMonitors.begin()), aEnd(maScreenMonitors.end()); aIt != aEnd; ++aIt) > { >- GdkScreen *pCmp = gdk_display_get_screen (pDisplay, i); >- if (pCmp == pScreen) >+ if (aIt->first == pScreen) > return nIdx; >- nIdx += gdk_screen_get_n_monitors (pCmp); >+ nIdx += aIt->second; > } > g_warning ("failed to find screen %p", pScreen); > return 0; > } > >-int GtkSalSystem::getScreenMonitorIdx (GdkDisplay *pDisplay, >- GdkScreen *pScreen, >+int GtkSalSystem::getScreenMonitorIdx (GdkScreen *pScreen, > int nX, int nY) > { >- return getScreenIdxFromPtr (pDisplay, pScreen) + >+ // FIXME: this is possible problem, because we do not know what >+ // number gdk_screen_get_monitor_at_point will return if there are >+ // more monitors with the same geometry >+ return getScreenIdxFromPtr (pScreen) + > gdk_screen_get_monitor_at_point (pScreen, nX, nY); > } > > unsigned int GtkSalSystem::GetDisplayScreenCount() > { > gint nMonitor; >- (void)getScreenMonitorFromIdx (mpDisplay, G_MAXINT, nMonitor); >+ (void)getScreenMonitorFromIdx (G_MAXINT, nMonitor); > return G_MAXINT - nMonitor; > } > >@@ -183,7 +230,7 @@ static int _get_primary_monitor (GdkScreen *pScreen) > unsigned int GtkSalSystem::GetDisplayDefaultScreen() > { > GdkScreen *pDefault = gdk_display_get_default_screen (mpDisplay); >- int idx = getScreenIdxFromPtr (mpDisplay, pDefault); >+ int idx = getScreenIdxFromPtr (pDefault); > return idx + _get_primary_monitor (pDefault); > } > >@@ -192,7 +239,7 @@ Rectangle GtkSalSystem::GetDisplayScreenPosSizePixel (unsigned int nScreen) > gint nMonitor; > GdkScreen *pScreen; > GdkRectangle aRect; >- pScreen = getScreenMonitorFromIdx (mpDisplay, nScreen, nMonitor); >+ pScreen = getScreenMonitorFromIdx (nScreen, nMonitor); > if (!pScreen) > return Rectangle(); > gdk_screen_get_monitor_geometry (pScreen, nMonitor, &aRect); >@@ -212,7 +259,7 @@ rtl::OUString GtkSalSystem::GetDisplayScreenName(unsigned int nScreen) > gchar *pStr; > gint nMonitor; > GdkScreen *pScreen; >- pScreen = getScreenMonitorFromIdx (mpDisplay, nScreen, nMonitor); >+ pScreen = getScreenMonitorFromIdx (nScreen, nMonitor); > if (!pScreen) > return rtl::OUString(); > >diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx >index a647bf8..8c91208 100644 >--- a/vcl/unx/gtk/window/gtkframe.cxx >+++ b/vcl/unx/gtk/window/gtkframe.cxx >@@ -590,7 +590,7 @@ void GtkSalFrame::updateScreenNumber() > int nScreen = 0; > GdkScreen *pScreen = gtk_widget_get_screen( m_pWindow ); > if( pScreen ) >- nScreen = GtkSalSystem::getScreenMonitorIdx( getGdkDisplay(), pScreen, maGeometry.nX, maGeometry.nY ); >+ nScreen = getDisplay()->getSystem()->getScreenMonitorIdx( pScreen, maGeometry.nX, maGeometry.nY ); > maGeometry.nDisplayScreenNumber = nScreen; > } > >@@ -1859,7 +1859,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz > > gint nMonitor; > GdkScreen *pScreen = NULL; >- pScreen = GtkSalSystem::getScreenMonitorFromIdx( getGdkDisplay(), nNewScreen, nMonitor ); >+ pScreen = getDisplay()->getSystem()->getScreenMonitorFromIdx( nNewScreen, nMonitor ); > > // Heavy lifting, need to move screen ... > if( pScreen != gtk_widget_get_screen( m_pWindow )) >-- >1.7.7.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 809019
: 580165