diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-21 12:31:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-21 14:58:51 +0200 |
commit | 29489b33b435683021b72cb2bce27aba8cb7a430 (patch) | |
tree | 8e4e1c59d56d5ed0d0ca4d088419067041e4553a /vcl/unx | |
parent | a4244c0f05b95ded277a3a7ed217bf0451daa996 (diff) |
loplugin:flatten
Change-Id: I3b4226a9d089ec9aedab95d96e50a068f57a76c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123991
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/gtkframe.cxx | 140 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 94 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkobject.cxx | 56 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtksalmenu.cxx | 62 | ||||
-rw-r--r-- | vcl/unx/gtk3/salnativewidgets-gtk.cxx | 38 |
5 files changed, 195 insertions, 195 deletions
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 41e621db24db..a4463bde6d06 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -528,61 +528,61 @@ static void attach_menu_model(GtkSalFrame* pSalFrame) GtkWidget* pWidget = pSalFrame->getWindow(); GdkSurface* gdkWindow = widget_get_surface(pWidget); - if ( gdkWindow != nullptr && g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-menubar" ) == nullptr ) - { - // Create menu model and action group attached to this frame. - GMenuModel* pMenuModel = G_MENU_MODEL( g_lo_menu_new() ); - GActionGroup* pActionGroup = reinterpret_cast<GActionGroup*>(g_lo_action_group_new()); + if ( gdkWindow == nullptr || g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-menubar" ) != nullptr ) + return; + + // Create menu model and action group attached to this frame. + GMenuModel* pMenuModel = G_MENU_MODEL( g_lo_menu_new() ); + GActionGroup* pActionGroup = reinterpret_cast<GActionGroup*>(g_lo_action_group_new()); - // Set window properties. - g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-menubar", pMenuModel, ObjectDestroyedNotify ); - g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify ); + // Set window properties. + g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-menubar", pMenuModel, ObjectDestroyedNotify ); + g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify ); #if !GTK_CHECK_VERSION(4,0,0) - // Get a DBus session connection. - if (!pSessionBus) - pSessionBus = g_bus_get_sync (G_BUS_TYPE_SESSION, nullptr, nullptr); - if (!pSessionBus) - return; + // Get a DBus session connection. + if (!pSessionBus) + pSessionBus = g_bus_get_sync (G_BUS_TYPE_SESSION, nullptr, nullptr); + if (!pSessionBus) + return; - // Generate menu paths. - sal_uIntPtr windowId = GtkSalFrame::GetNativeWindowHandle(pWidget); - gchar* aDBusWindowPath = g_strdup_printf( "/org/libreoffice/window/%lu", windowId ); - gchar* aDBusMenubarPath = g_strdup_printf( "/org/libreoffice/window/%lu/menus/menubar", windowId ); + // Generate menu paths. + sal_uIntPtr windowId = GtkSalFrame::GetNativeWindowHandle(pWidget); + gchar* aDBusWindowPath = g_strdup_printf( "/org/libreoffice/window/%lu", windowId ); + gchar* aDBusMenubarPath = g_strdup_printf( "/org/libreoffice/window/%lu/menus/menubar", windowId ); - GdkDisplay *pDisplay = GtkSalFrame::getGdkDisplay(); + GdkDisplay *pDisplay = GtkSalFrame::getGdkDisplay(); #if defined(GDK_WINDOWING_X11) - if (DLSYM_GDK_IS_X11_DISPLAY(pDisplay)) - { - gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_APPLICATION_ID", "org.libreoffice" ); - gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_MENUBAR_OBJECT_PATH", aDBusMenubarPath ); - gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_WINDOW_OBJECT_PATH", aDBusWindowPath ); - gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_APPLICATION_OBJECT_PATH", "/org/libreoffice" ); - gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_UNIQUE_BUS_NAME", g_dbus_connection_get_unique_name( pSessionBus ) ); - } + if (DLSYM_GDK_IS_X11_DISPLAY(pDisplay)) + { + gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_APPLICATION_ID", "org.libreoffice" ); + gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_MENUBAR_OBJECT_PATH", aDBusMenubarPath ); + gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_WINDOW_OBJECT_PATH", aDBusWindowPath ); + gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_APPLICATION_OBJECT_PATH", "/org/libreoffice" ); + gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_UNIQUE_BUS_NAME", g_dbus_connection_get_unique_name( pSessionBus ) ); + } #endif #if defined(GDK_WINDOWING_WAYLAND) - if (DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay)) - { - gdk_wayland_window_set_dbus_properties_libgtk_only(gdkWindow, "org.libreoffice", - nullptr, - aDBusMenubarPath, - aDBusWindowPath, - "/org/libreoffice", - g_dbus_connection_get_unique_name( pSessionBus )); - } + if (DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay)) + { + gdk_wayland_window_set_dbus_properties_libgtk_only(gdkWindow, "org.libreoffice", + nullptr, + aDBusMenubarPath, + aDBusWindowPath, + "/org/libreoffice", + g_dbus_connection_get_unique_name( pSessionBus )); + } #endif - // Publish the menu model and the action group. - SAL_INFO("vcl.unity", "exporting menu model at " << pMenuModel << " for window " << windowId); - pSalFrame->m_nMenuExportId = g_dbus_connection_export_menu_model (pSessionBus, aDBusMenubarPath, pMenuModel, nullptr); - SAL_INFO("vcl.unity", "exporting action group at " << pActionGroup << " for window " << windowId); - pSalFrame->m_nActionGroupExportId = g_dbus_connection_export_action_group( pSessionBus, aDBusWindowPath, pActionGroup, nullptr); - pSalFrame->m_nHudAwarenessId = hud_awareness_register( pSessionBus, aDBusMenubarPath, hud_activated, pSalFrame, nullptr, nullptr ); + // Publish the menu model and the action group. + SAL_INFO("vcl.unity", "exporting menu model at " << pMenuModel << " for window " << windowId); + pSalFrame->m_nMenuExportId = g_dbus_connection_export_menu_model (pSessionBus, aDBusMenubarPath, pMenuModel, nullptr); + SAL_INFO("vcl.unity", "exporting action group at " << pActionGroup << " for window " << windowId); + pSalFrame->m_nActionGroupExportId = g_dbus_connection_export_action_group( pSessionBus, aDBusWindowPath, pActionGroup, nullptr); + pSalFrame->m_nHudAwarenessId = hud_awareness_register( pSessionBus, aDBusMenubarPath, hud_activated, pSalFrame, nullptr, nullptr ); - g_free( aDBusWindowPath ); - g_free( aDBusMenubarPath ); + g_free( aDBusWindowPath ); + g_free( aDBusMenubarPath ); #endif - } } void on_registrar_available( GDBusConnection * /*connection*/, @@ -1496,25 +1496,25 @@ void GtkSalFrame::SetIcon(const char* appicon) gtk_window_set_icon_name(GTK_WINDOW(m_pWindow), appicon); #if defined(GDK_WINDOWING_WAYLAND) - if (DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay())) - { + if (!DLSYM_GDK_IS_WAYLAND_DISPLAY(getGdkDisplay())) + return; + #if GTK_CHECK_VERSION(4,0,0) - GdkSurface* gdkWindow = gtk_native_get_surface(gtk_widget_get_native(m_pWindow)); - gdk_wayland_toplevel_set_application_id((GDK_TOPLEVEL(gdkWindow)), appicon); + GdkSurface* gdkWindow = gtk_native_get_surface(gtk_widget_get_native(m_pWindow)); + gdk_wayland_toplevel_set_application_id((GDK_TOPLEVEL(gdkWindow)), appicon); #else - static auto set_application_id = reinterpret_cast<void (*) (GdkWindow*, const char*)>( - dlsym(nullptr, "gdk_wayland_window_set_application_id")); - if (set_application_id) - { - GdkSurface* gdkWindow = widget_get_surface(m_pWindow); - set_application_id(gdkWindow, appicon); - } -#endif - // gdk_wayland_window_set_application_id doesn't seem to work before - // the window is mapped, so set this for real when/if we are mapped - m_bIconSetWhileUnmapped = !gtk_widget_get_mapped(m_pWindow); + static auto set_application_id = reinterpret_cast<void (*) (GdkWindow*, const char*)>( + dlsym(nullptr, "gdk_wayland_window_set_application_id")); + if (set_application_id) + { + GdkSurface* gdkWindow = widget_get_surface(m_pWindow); + set_application_id(gdkWindow, appicon); } #endif + // gdk_wayland_window_set_application_id doesn't seem to work before + // the window is mapped, so set this for real when/if we are mapped + m_bIconSetWhileUnmapped = !gtk_widget_get_mapped(m_pWindow); +#endif } void GtkSalFrame::SetIcon( sal_uInt16 nIcon ) @@ -5079,19 +5079,19 @@ void GtkSalFrame::IMHandler::createIMContext() void GtkSalFrame::IMHandler::deleteIMContext() { - if( m_pIMContext ) - { - // first give IC a chance to deinitialize - GetGenericUnixSalData()->ErrorTrapPush(); + if( !m_pIMContext ) + return; + + // first give IC a chance to deinitialize + GetGenericUnixSalData()->ErrorTrapPush(); #if GTK_CHECK_VERSION(4, 0, 0) - gtk_event_controller_key_set_im_context(m_pFrame->m_pKeyController, nullptr); + gtk_event_controller_key_set_im_context(m_pFrame->m_pKeyController, nullptr); #endif - im_context_set_client_widget(m_pIMContext, nullptr); - GetGenericUnixSalData()->ErrorTrapPop(); - // destroy old IC - g_object_unref( m_pIMContext ); - m_pIMContext = nullptr; - } + im_context_set_client_widget(m_pIMContext, nullptr); + GetGenericUnixSalData()->ErrorTrapPop(); + // destroy old IC + g_object_unref( m_pIMContext ); + m_pIMContext = nullptr; } void GtkSalFrame::IMHandler::doCallEndExtTextInput() diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index b76bd0dac1f0..6a69b9909b7f 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2771,22 +2771,22 @@ protected: } #if !GTK_CHECK_VERSION(4, 0, 0) - if (m_pMouseEventBox && m_pMouseEventBox != m_pWidget) - { - // put things back they way we found them - GtkWidget* pParent = gtk_widget_get_parent(m_pMouseEventBox); + if (!(m_pMouseEventBox && m_pMouseEventBox != m_pWidget)) + return; - g_object_ref(m_pWidget); - gtk_container_remove(GTK_CONTAINER(m_pMouseEventBox), m_pWidget); + // put things back they way we found them + GtkWidget* pParent = gtk_widget_get_parent(m_pMouseEventBox); - gtk_widget_destroy(m_pMouseEventBox); + g_object_ref(m_pWidget); + gtk_container_remove(GTK_CONTAINER(m_pMouseEventBox), m_pWidget); - gtk_container_add(GTK_CONTAINER(pParent), m_pWidget); - // coverity[freed_arg : FALSE] - this does not free m_pWidget, it is reffed by pParent - g_object_unref(m_pWidget); + gtk_widget_destroy(m_pMouseEventBox); - m_pMouseEventBox = m_pWidget; - } + gtk_container_add(GTK_CONTAINER(pParent), m_pWidget); + // coverity[freed_arg : FALSE] - this does not free m_pWidget, it is reffed by pParent + g_object_unref(m_pWidget); + + m_pMouseEventBox = m_pWidget; #endif } @@ -8891,22 +8891,22 @@ public: GtkWidget* pOverFlowWidget = GTK_WIDGET(m_pOverFlowNotebook); g_clear_pointer(&pOverFlowWidget, gtk_widget_unparent); #endif - if (m_pOverFlowBox) - { - // put it back to how we found it initially - GtkWidget* pParent = gtk_widget_get_parent(GTK_WIDGET(m_pOverFlowBox)); - g_object_ref(m_pNotebook); - container_remove(GTK_WIDGET(m_pOverFlowBox), GTK_WIDGET(m_pNotebook)); - container_add(GTK_WIDGET(pParent), GTK_WIDGET(m_pNotebook)); - g_object_unref(m_pNotebook); + if (!m_pOverFlowBox) + return; + + // put it back to how we found it initially + GtkWidget* pParent = gtk_widget_get_parent(GTK_WIDGET(m_pOverFlowBox)); + g_object_ref(m_pNotebook); + container_remove(GTK_WIDGET(m_pOverFlowBox), GTK_WIDGET(m_pNotebook)); + container_add(GTK_WIDGET(pParent), GTK_WIDGET(m_pNotebook)); + g_object_unref(m_pNotebook); #if !GTK_CHECK_VERSION(4, 0, 0) - gtk_widget_destroy(GTK_WIDGET(m_pOverFlowBox)); + gtk_widget_destroy(GTK_WIDGET(m_pOverFlowBox)); #else - GtkWidget* pOverFlowBox = GTK_WIDGET(m_pOverFlowBox); - g_clear_pointer(&pOverFlowBox, gtk_widget_unparent); + GtkWidget* pOverFlowBox = GTK_WIDGET(m_pOverFlowBox); + g_clear_pointer(&pOverFlowBox, gtk_widget_unparent); #endif - } } }; @@ -9848,21 +9848,21 @@ private: void ensure_image_widget() { - if (!m_pImage) - { + if (m_pImage) + return; + #if !GTK_CHECK_VERSION(4, 0, 0) - m_pImage = GTK_IMAGE(gtk_image_new()); - gtk_box_pack_start(m_pBox, GTK_WIDGET(m_pImage), false, false, 0); - gtk_box_reorder_child(m_pBox, GTK_WIDGET(m_pImage), 0); + m_pImage = GTK_IMAGE(gtk_image_new()); + gtk_box_pack_start(m_pBox, GTK_WIDGET(m_pImage), false, false, 0); + gtk_box_reorder_child(m_pBox, GTK_WIDGET(m_pImage), 0); #else - m_pImage = GTK_PICTURE(gtk_picture_new()); - gtk_widget_set_halign(GTK_WIDGET(m_pImage), GTK_ALIGN_CENTER); - gtk_widget_set_valign(GTK_WIDGET(m_pImage), GTK_ALIGN_CENTER); - gtk_box_prepend(m_pBox, GTK_WIDGET(m_pImage)); - gtk_widget_set_halign(m_pLabel, GTK_ALIGN_START); + m_pImage = GTK_PICTURE(gtk_picture_new()); + gtk_widget_set_halign(GTK_WIDGET(m_pImage), GTK_ALIGN_CENTER); + gtk_widget_set_valign(GTK_WIDGET(m_pImage), GTK_ALIGN_CENTER); + gtk_box_prepend(m_pBox, GTK_WIDGET(m_pImage)); + gtk_widget_set_halign(m_pLabel, GTK_ALIGN_START); #endif - gtk_widget_show(GTK_WIDGET(m_pImage)); - } + gtk_widget_show(GTK_WIDGET(m_pImage)); } #if GTK_CHECK_VERSION(4, 0, 0) @@ -19692,18 +19692,18 @@ private: menu_toggled(); bool bIsShown = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_pToggleButton)); - if (m_bPopupActive != bIsShown) + if (m_bPopupActive == bIsShown) + return; + + m_bPopupActive = bIsShown; + ComboBox::signal_popup_toggled(); + if (!m_bPopupActive && m_pEntry) { - m_bPopupActive = bIsShown; - ComboBox::signal_popup_toggled(); - if (!m_bPopupActive && m_pEntry) - { - disable_notify_events(); - //restore focus to the GtkEntry when the popup is gone, which - //is what the vcl case does, to ease the transition a little - gtk_widget_grab_focus(m_pEntry); - enable_notify_events(); - } + disable_notify_events(); + //restore focus to the GtkEntry when the popup is gone, which + //is what the vcl case does, to ease the transition a little + gtk_widget_grab_focus(m_pEntry); + enable_notify_events(); } } diff --git a/vcl/unx/gtk3/gtkobject.cxx b/vcl/unx/gtk3/gtkobject.cxx index d5fb4119a98b..d712dae3c8bb 100644 --- a/vcl/unx/gtk3/gtkobject.cxx +++ b/vcl/unx/gtk3/gtkobject.cxx @@ -110,22 +110,22 @@ GtkSalObjectBase::~GtkSalObjectBase() GtkSalObject::~GtkSalObject() { - if( m_pSocket ) - { + if( !m_pSocket ) + return; + #if GTK_CHECK_VERSION(4, 0, 0) - gtk_widget_unparent(m_pSocket); + gtk_widget_unparent(m_pSocket); #else - // remove socket from parent frame's fixed container - gtk_container_remove( GTK_CONTAINER(gtk_widget_get_parent(m_pSocket)), - m_pSocket ); - // get rid of the socket - // actually the gtk_container_remove should let the ref count - // of the socket sink to 0 and destroy it (see signalDestroy) - // this is just a sanity check - if( m_pSocket ) - gtk_widget_destroy( m_pSocket ); + // remove socket from parent frame's fixed container + gtk_container_remove( GTK_CONTAINER(gtk_widget_get_parent(m_pSocket)), + m_pSocket ); + // get rid of the socket + // actually the gtk_container_remove should let the ref count + // of the socket sink to 0 and destroy it (see signalDestroy) + // this is just a sanity check + if( m_pSocket ) + gtk_widget_destroy( m_pSocket ); #endif - } } void GtkSalObject::ResetClipRegion() @@ -357,24 +357,24 @@ GtkSalObjectWidgetClip::GtkSalObjectWidgetClip(GtkSalFrame* pParent, bool bShow) GtkSalObjectWidgetClip::~GtkSalObjectWidgetClip() { - if( m_pSocket ) - { - // remove socket from parent frame's fixed container + if( !m_pSocket ) + return; + + // remove socket from parent frame's fixed container #if !GTK_CHECK_VERSION(4, 0, 0) - gtk_container_remove( GTK_CONTAINER(gtk_widget_get_parent(m_pScrolledWindow)), - m_pScrolledWindow ); - - // get rid of the socket - // actually the gtk_container_remove should let the ref count - // of the socket sink to 0 and destroy it (see signalDestroy) - // this is just a sanity check - if( m_pScrolledWindow ) - gtk_widget_destroy( m_pScrolledWindow ); + gtk_container_remove( GTK_CONTAINER(gtk_widget_get_parent(m_pScrolledWindow)), + m_pScrolledWindow ); + + // get rid of the socket + // actually the gtk_container_remove should let the ref count + // of the socket sink to 0 and destroy it (see signalDestroy) + // this is just a sanity check + if( m_pScrolledWindow ) + gtk_widget_destroy( m_pScrolledWindow ); #else - gtk_fixed_remove(GTK_FIXED(gtk_widget_get_parent(m_pScrolledWindow)), - m_pScrolledWindow); + gtk_fixed_remove(GTK_FIXED(gtk_widget_get_parent(m_pScrolledWindow)), + m_pScrolledWindow); #endif - } } void GtkSalObjectWidgetClip::ResetClipRegion() diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index 9e7d9edf050f..e0a35c1d5404 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -856,19 +856,19 @@ void GtkSalMenu::RemoveMenuBarButton( sal_uInt16 nId ) { const auto it = std::find_if(maExtraButtons.begin(), maExtraButtons.end(), [&nId](const auto &item) { return item.first == nId; }); - if (it != maExtraButtons.end()) - { - gint nAttach(0); + if (it == maExtraButtons.end()) + return; + + gint nAttach(0); #if !GTK_CHECK_VERSION(4, 0, 0) - gtk_container_child_get(GTK_CONTAINER(mpMenuBarContainerWidget), it->second, "left-attach", &nAttach, nullptr); - gtk_widget_destroy(it->second); + gtk_container_child_get(GTK_CONTAINER(mpMenuBarContainerWidget), it->second, "left-attach", &nAttach, nullptr); + gtk_widget_destroy(it->second); #else - gtk_grid_query_child(GTK_GRID(mpMenuBarContainerWidget), it->second, &nAttach, nullptr, nullptr, nullptr); - g_clear_pointer(&(it->second), gtk_widget_unparent); + gtk_grid_query_child(GTK_GRID(mpMenuBarContainerWidget), it->second, &nAttach, nullptr, nullptr, nullptr); + g_clear_pointer(&(it->second), gtk_widget_unparent); #endif - gtk_grid_remove_column(GTK_GRID(mpMenuBarContainerWidget), nAttach); - maExtraButtons.erase(it); - } + gtk_grid_remove_column(GTK_GRID(mpMenuBarContainerWidget), nAttach); + maExtraButtons.erase(it); } tools::Rectangle GtkSalMenu::GetMenuBarButtonRectPixel(sal_uInt16 nId, SalFrame* pReferenceFrame) @@ -1103,20 +1103,20 @@ void GtkSalMenu::ApplyPersona() void GtkSalMenu::DestroyMenuBarWidget() { - if (mpMenuBarContainerWidget) - { + if (!mpMenuBarContainerWidget) + return; + #if !GTK_CHECK_VERSION(4, 0, 0) - // tdf#140225 call cancel before destroying it in case there are some - // active menus popped open - gtk_menu_shell_cancel(GTK_MENU_SHELL(mpMenuBarWidget)); + // tdf#140225 call cancel before destroying it in case there are some + // active menus popped open + gtk_menu_shell_cancel(GTK_MENU_SHELL(mpMenuBarWidget)); - gtk_widget_destroy(mpMenuBarContainerWidget); + gtk_widget_destroy(mpMenuBarContainerWidget); #else - g_clear_pointer(&mpMenuBarContainerWidget, gtk_widget_unparent); + g_clear_pointer(&mpMenuBarContainerWidget, gtk_widget_unparent); #endif - mpMenuBarContainerWidget = nullptr; - mpCloseButton = nullptr; - } + mpMenuBarContainerWidget = nullptr; + mpCloseButton = nullptr; } void GtkSalMenu::SetFrame(const SalFrame* pFrame) @@ -1438,21 +1438,21 @@ void GtkSalMenu::ActivateAllSubmenus(Menu* pMenuBar) // We can re-enter this method via the new event loop that gets created // in GtkClipboardTransferable::getTransferDataFlavorsAsVector, so use the InActivateCallback // flag to detect that and skip some startup work. - if (!mbInActivateCallback) + if (mbInActivateCallback) + return; + + mbInActivateCallback = true; + pMenuBar->HandleMenuActivateEvent(GetMenu()); + mbInActivateCallback = false; + for (GtkSalMenuItem* pSalItem : maItems) { - mbInActivateCallback = true; - pMenuBar->HandleMenuActivateEvent(GetMenu()); - mbInActivateCallback = false; - for (GtkSalMenuItem* pSalItem : maItems) + if ( pSalItem->mpSubMenu != nullptr ) { - if ( pSalItem->mpSubMenu != nullptr ) - { - pSalItem->mpSubMenu->ActivateAllSubmenus(pMenuBar); - } + pSalItem->mpSubMenu->ActivateAllSubmenus(pMenuBar); } - Update(); - pMenuBar->HandleMenuDeActivateEvent(GetMenu()); } + Update(); + pMenuBar->HandleMenuDeActivateEvent(GetMenu()); } void GtkSalMenu::ClearActionGroupAndMenuModel() diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx b/vcl/unx/gtk3/salnativewidgets-gtk.cxx index 8fe550371d7e..47556a97edc5 100644 --- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx @@ -744,30 +744,30 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context, aTrackRect.GetWidth(), aTrackRect.GetHeight() ); // ----------------- THUMB - if ( has_slider ) - { - stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnThumbState); - if ( rScrollbarVal.mnThumbState & ControlState::PRESSED ) - stateFlags = static_cast<GtkStateFlags>(stateFlags | GTK_STATE_FLAG_PRELIGHT); + if ( !has_slider ) + return; - GtkStyleContext* pScrollbarSliderStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ? - mpVScrollbarSliderStyle : mpHScrollbarSliderStyle; + stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnThumbState); + if ( rScrollbarVal.mnThumbState & ControlState::PRESSED ) + stateFlags = static_cast<GtkStateFlags>(stateFlags | GTK_STATE_FLAG_PRELIGHT); - gtk_style_context_set_state(pScrollbarSliderStyle, stateFlags); + GtkStyleContext* pScrollbarSliderStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ? + mpVScrollbarSliderStyle : mpHScrollbarSliderStyle; - GtkBorder margin; - style_context_get_margin(pScrollbarSliderStyle, &margin); + gtk_style_context_set_state(pScrollbarSliderStyle, stateFlags); - gtk_render_background(pScrollbarSliderStyle, cr, - thumbRect.Left() + margin.left, thumbRect.Top() + margin.top, - thumbRect.GetWidth() - margin.left - margin.right, - thumbRect.GetHeight() - margin.top - margin.bottom); + GtkBorder margin; + style_context_get_margin(pScrollbarSliderStyle, &margin); - gtk_render_frame(pScrollbarSliderStyle, cr, - thumbRect.Left() + margin.left, thumbRect.Top() + margin.top, - thumbRect.GetWidth() - margin.left - margin.right, - thumbRect.GetHeight() - margin.top - margin.bottom); - } + gtk_render_background(pScrollbarSliderStyle, cr, + thumbRect.Left() + margin.left, thumbRect.Top() + margin.top, + thumbRect.GetWidth() - margin.left - margin.right, + thumbRect.GetHeight() - margin.top - margin.bottom); + + gtk_render_frame(pScrollbarSliderStyle, cr, + thumbRect.Left() + margin.left, thumbRect.Top() + margin.top, + thumbRect.GetWidth() - margin.left - margin.right, + thumbRect.GetHeight() - margin.top - margin.bottom); } void GtkSalGraphics::PaintOneSpinButton( GtkStyleContext *context, |