[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 13 18:31:55 UTC 2020
vcl/unx/gtk3/gtk3gtkframe.cxx | 15 ++++++---------
vcl/unx/gtk3/gtk3gtkobject.cxx | 2 +-
2 files changed, 7 insertions(+), 10 deletions(-)
New commits:
commit 48ee17acde5189318963f302ed6f987c11f3a39f
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 13 14:50:38 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed May 13 20:31:15 2020 +0200
use gtk_widget_get_screen instead of cast + gtk_window_get_screen
cause the toplevel may not be a GtkWindow
Change-Id: Iceb1fc9a5d0054a7a2aefa5ba2ad7a2572dbb4c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94134
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 0960b46354d2..31d4d8dbb1f5 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -962,12 +962,9 @@ void GtkSalFrame::InitCommon()
{
m_aSystemData.pDisplay = gdk_x11_display_get_xdisplay(pDisplay);
m_aSystemData.platform = SystemEnvData::Platform::Xcb;
- if (GTK_IS_WINDOW(m_pWindow))
- {
- GdkScreen* pScreen = gtk_window_get_screen(GTK_WINDOW(m_pWindow));
- GdkVisual* pVisual = gdk_screen_get_system_visual(pScreen);
- m_aSystemData.pVisual = gdk_x11_visual_get_xvisual(pVisual);
- }
+ GdkScreen* pScreen = gtk_widget_get_screen(m_pWindow);
+ GdkVisual* pVisual = gdk_screen_get_system_visual(pScreen);
+ m_aSystemData.pVisual = gdk_x11_visual_get_xvisual(pVisual);
}
#endif
#if defined(GDK_WINDOWING_WAYLAND)
@@ -1062,7 +1059,7 @@ void GtkSalFrame::Init( SalFrame* pParent, SalFrameStyleFlags nStyle )
{
GtkWidget* pTopLevel = gtk_widget_get_toplevel(m_pParent->m_pWindow);
if (!isChild())
- gtk_window_set_screen(GTK_WINDOW(m_pWindow), gtk_window_get_screen(GTK_WINDOW(pTopLevel)));
+ gtk_window_set_screen(GTK_WINDOW(m_pWindow), gtk_widget_get_screen(pTopLevel));
if (!(m_pParent->m_nStyle & SalFrameStyleFlags::PLUG))
gtk_window_set_transient_for(GTK_WINDOW(m_pWindow), GTK_WINDOW(pTopLevel));
@@ -1539,7 +1536,7 @@ void GtkSalFrame::GetClientSize( long& rWidth, long& rHeight )
void GtkSalFrame::GetWorkArea( tools::Rectangle& rRect )
{
- GdkScreen *pScreen = gtk_window_get_screen(GTK_WINDOW(m_pWindow));
+ GdkScreen *pScreen = gtk_widget_get_screen(m_pWindow);
tools::Rectangle aRetRect;
int max = gdk_screen_get_n_monitors (pScreen);
for (int i = 0; i < max; ++i)
@@ -2031,7 +2028,7 @@ void GtkSalFrame::SetPointerPos( long nX, long nY )
if( ! pFrame )
return;
- GdkScreen *pScreen = gtk_window_get_screen( GTK_WINDOW(pFrame->m_pWindow) );
+ GdkScreen *pScreen = gtk_widget_get_screen(pFrame->m_pWindow);
GdkDisplay *pDisplay = gdk_screen_get_display( pScreen );
/* when the application tries to center the mouse in the dialog the
diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx
index 9b9fff958908..219805daed49 100644
--- a/vcl/unx/gtk3/gtk3gtkobject.cxx
+++ b/vcl/unx/gtk3/gtk3gtkobject.cxx
@@ -71,7 +71,7 @@ void GtkSalObjectBase::Init()
m_aSystemData.pWidget = m_pSocket;
m_aSystemData.nScreen = m_pParent->getXScreenNumber().getXScreen();
m_aSystemData.toolkit = SystemEnvData::Toolkit::Gtk3;
- GdkScreen* pScreen = gtk_window_get_screen(GTK_WINDOW(m_pParent->getWindow()));
+ GdkScreen* pScreen = gtk_widget_get_screen(m_pParent->getWindow());
GdkVisual* pVisual = gdk_screen_get_system_visual(pScreen);
#if defined(GDK_WINDOWING_X11)
More information about the Libreoffice-commits
mailing list