diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-13 14:50:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-05-13 20:31:15 +0200 |
commit | 48ee17acde5189318963f302ed6f987c11f3a39f (patch) | |
tree | a272d8f03217da9c8c6b04e91d61361e5b4d430d /vcl/unx | |
parent | 1d6af937da9d24a0cc30f0324f8f23d0c1156ccd (diff) |
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@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkframe.cxx | 15 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkobject.cxx | 2 |
2 files changed, 7 insertions, 10 deletions
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) |