Skip to content

GTK 2 cleanups - #505

Merged
pgiffuni merged 2 commits into
apache:trunkfrom
pgiffuni:trunk
Sep 25, 2026
Merged

pgiffuni merged 2 commits into
apache:trunkfrom
pgiffuni:trunk

Conversation

@pgiffuni

@pgiffuni pgiffuni commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

GTK/X11 event and window cleanup

Isolate GTX/X11 functions (will make it easier to run on Wayland)

This is essential for the more fundamental changes coming forward.

Reduce GTK2 implementation-detail dependencies in native widget rendering.

- Replace direct GTK_WIDGET_SET_FLAGS / UNSET_FLAGS flag twiddling with
  public GTK2 APIs (gtk_widget_set_can_focus, gtk_widget_set_can_default,
  gtk_widget_set_sensitive) in GtkSalFrame::Init, NWSetWidgetState, and
  toolbar/toggle button rendering. GTK 2.18+ is the minimum required version.
- Remove redundant sensitivity flag manipulation in toolbar, grip,
  menubar, and popup menu rendering.
- Consolidate repetitive widget style realization and default flag capture
  into NWInitWidget().
- Use sal_IntPtr for gWidgetDefaultFlags hash_map key for 64-bit portability.
- Clean up gWidgetDefaultFlags and gWidgetData in GtkData::deInitNWF().

No functional change intended.
Replace direct access to GTK internal struct members (m_pWindow->window,
->style) with public GTK2 APIs (gtk_widget_get_window, gtk_widget_get_style)
through safe accessor methods getGdkWindow() and getXWindow() on GtkSalFrame.

- Add getGdkWindow()/getXWindow() accessors on GtkSalFrame with null guards
- Update GtkSalGraphics::GetGdkWindow() to use gtk_widget_get_window()
- Remove unused GetGtkWidget() (0 callers)
- Replace all m_pWindow->window accesses with getGdkWindow()/getXWindow()
- Replace GTK_WIDGET(m_pWindow)->window with GetGdkWindow()
- Replace m_pWindow->style with gtk_widget_get_style()
- Replace m_pSocket->window with gtk_widget_get_window(m_pSocket)
- Replace GDK_WINDOW_XWINDOW(GTK_WIDGET(pParent->getWindow())->window) with
  pParent->getXWindow()
- Add DeInit() call before graphics deletion in GraphicsHolder destructor
- Sync window/drawable when returning existing cached graphics instance
- Detach/resync all allocated graphics (pGraphics != NULL), not just bInUse,
  in createNewWindow() and moveToScreen()
- Reset m_pWindow = NULL in GtkSalGraphics destructor
- Guard gdkDrawable and GetGdkWindow() against NULL to prevent painting when
  widget is unmapped or destroyed
@pgiffuni
pgiffuni merged commit 605bd59 into apache:trunk Sep 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant