Skip to content

fix(bug38): intercept F5/Esc in CEF sidebar so Impress slideshow keys reach LO#61

Closed
Pher217 wants to merge 132 commits into
LibreOffice:masterfrom
Pher217:claude/2026-05-26-bug38-slideshow-fix
Closed

fix(bug38): intercept F5/Esc in CEF sidebar so Impress slideshow keys reach LO#61
Pher217 wants to merge 132 commits into
LibreOffice:masterfrom
Pher217:claude/2026-05-26-bug38-slideshow-fix

Conversation

@Pher217
Copy link
Copy Markdown

@Pher217 Pher217 commented May 25, 2026

Root cause

WebViewCefClient had no CefKeyboardHandler, so pressing F5 while the AI sidebar had keyboard focus was consumed by CEF as a browser page-reload instead of being dispatched to LibreOffice as .uno:Presentation.

This happens because:

  1. The user's registrymodifications.xcu sets LastActiveDeck = AIDeck for PresentationDocument, so the AI panel auto-opens and the CEF popup appears when Impress loads.
  2. Once the user types into the chat input, keyboard focus moves to the CEF popup (Win32 top-level WS_POPUP window).
  3. With no CefKeyboardHandler, F5 goes to Chrome's default keybinding (refresh page). LibreOffice never sees it.

Confirmed not the cause:

  • F5 accelerator binding in main.xcd is correct: .uno:Presentation for PresentationDocument
  • No inject-script patches touch slideshow or accelerators
  • slideshowlo.dll / sdlo.dll are installed and registered

Fix

Added CefKeyboardHandler to WebViewCefClient:

  • GetKeyboardHandler() returns this
  • OnPreKeyEvent() intercepts VK_F5 and VK_ESCAPE (before CEF processes them)
  • For those keys: SetForegroundWindow(hFrame) + PostMessage(hFrame, WM_KEYDOWN, ...) → the LO accelerator table fires
  • All other keys return false (pass through to CEF unchanged)
  • Shift+F5 is handled by passing lp with Shift scan-code set

Files changed

  • officelabs/inc/officelabs/WebViewPanel.hxx — added getFrameHwnd() accessor
  • officelabs/source/WebViewPanel.cxxCefKeyboardHandler on WebViewCefClient

Acceptance criteria

  • F5 in Impress opens fullscreen presentation (from first slide)
  • Shift+F5 starts from current slide
  • Esc exits the running slideshow
  • No regression: F5 in Writer/Calc still works as expected
  • AI sidebar chat still works normally (typing, Enter, Backspace all pass through)

Build note

This is a C++ change in the officelabs library. Requires a full LO fork rebuild before testing in the installed product (make officelabs.build or full incremental CI build).

Pher217 and others added 30 commits October 23, 2025 16:12
- Add AIAssistantPanel.cxx/hxx for sidebar AI chat functionality
- Add chatpanel.ui for the chat interface
- Update SwPanelFactory.cxx to register the AI panel
- Update sw/Library_sw.mk to include AI panel in build
- Add officelabs module with AgentConnection and DocumentController
- Integrate with officelabs backend for AI assistance
- Add build.log and config_attempt1.log for build tracking
- Update autogen.sh with configuration changes
- Update config.guess and config.sub
- Add backup files for configuration scripts
- ChatPanel: Docking window for AI chat interface
- AgentConnection: HTTP client for backend communication
- DocumentController: Document context extraction

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added ChatPanel class for the AI chat interface with docking capabilities.
- Introduced new identifiers for AI chat integration in sfxsids.hrc.
- Updated Library_officelabs.mk to include new source files.
- Removed obsolete AgentConnection and DocumentController implementations.

This commit enhances the OfficeLabs integration by providing a user interface for AI interactions and streamlining backend communication.

Change-Id: I1234567890abcdef1234567890abcdef12345678
Build fixes for Windows compilation with Visual Studio 2026:

- Fix CScript syntax: Change /e:javascript to //E:JScript in libxml2,
  libxslt, and xmlsec configure scripts for Windows Script Host
- Add --fuzz=3 to patch applications for glm, lpsolve, and redland
  to handle line number offsets in patches
- Regenerate clang-cl patches with correct line numbers for glm and redland
- Disable non-critical lpsolve const patch that fails to apply
- Fix ATL include paths in so_activex and oleautobridge libraries
  (change foreach loop to direct -I flag)
- Add cygpath conversion for harfbuzz meson build to handle
  Cygwin-to-Windows path translation for cl.exe
- Add -k || true workaround for libgpg-error and libassuan mkheader
  compilation issues on Windows

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Updated gpgmepp and libassuan makefiles to ensure proper handling of resource files during the build process.
- Added necessary library paths for libgpg-error and libassuan on Windows.
- Improved environment setup by exporting the PATH variable to include local binaries.

These changes aim to resolve build issues and improve compatibility with Windows environments.

Co-Authored-By: Pher
- Update ExternalProject_gpgmepp.mk configuration
- Fix disable-versioninfo.patch.1 for Windows build
- Update build.log with current progress

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove failing Skia patches (fix-pch.patch.1, fix-semaphore-include.patch.1)
- Fix OfficeLabs Library include order for proper SDK header resolution
- Fix git binary discovery in g script
- Fix CRLF line endings in solenv/bin scripts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update ChatPanel.hxx to use vcl/toolkit/ include paths for
widget headers (fixed.hxx, edit.hxx, button.hxx) which were
reorganized in modern LibreOffice.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ChatPanel.hxx: Add VCL_INTERNALS define for deprecated toolkit headers
- ChatPanel.cxx: Fix OUString literal conversion (use u"..."_ustr)
- ChatPanelChildWindow.cxx: Add missing GetInfo() implementation
- AIAssistantPanel.hxx: Fix vcl/weld include paths and add TextView.hxx

All OfficeLabs code now compiles successfully.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pher217 added 27 commits April 6, 2026 17:05
…ields, skip native tab/button rendering, ruler contrast
LineWidthValueSet: replace hardcoded blue selection fill and COL_WHITE
text/line colors with GetHighlightColor/GetHighlightTextColor so the
line width selector respects the active dark/light theme.

ThemePanel: replace COL_LIGHTGRAY label background and border colors
with GetDialogColor/GetDialogTextColor/GetShadowColor so document
theme color-set swatches render correctly in dark mode.
Panel::mxContents (the GtkBox 'contents' from panel.ui) was never
getting a background color assigned, so it defaulted to white on
Windows. All panel content areas (Character, Paragraph, Page, etc.)
appeared white behind their widgets even though the deck and title
bars were dark.

Set mxContents->set_background(Theme::Color_PanelBackground) in the
constructor and refresh it in DataChanged() so the panel content area
matches the active theme.
CreateChildFrame() creates a VclBin with no explicit background,
so it defaulted to system white. All AWT sidebar panels (Character,
Paragraph, Page, etc.) rendered white content areas because the
panel content is embedded into this VclBin, not directly into
mxContents.

Fix: after CreateChildFrame(), get the VclBin via VCLUnoHelper and
call SetBackground(Wallpaper(panelBg)). Also refresh on DataChanged()
for theme switching.
VclContainer (VclBox, VclGrid, VclBin) sets SetPaintTransparent(true)
in its constructor. When set_background() is called on a parent
container (e.g. the sidebar PanelLayout root), only the root gets
SetPaintTransparent(false) and the explicit background color.

Nested VclGrid/VclBox widgets created from .ui files remain
paint-transparent. On Windows, these transparent children show white
instead of the parent's dark background because WS_CLIPCHILDREN and
window creation order prevent the parent from painting under them.

Fix: after setting the root container background, recursively walk
all child windows and make any paint-transparent ones explicitly
opaque with the same background color. This ensures nested containers
in sidebar panels (Character, Paragraph, Page, etc.) match the dark
theme instead of defaulting to white.
- Replace Windows .ico files: soffice.ico, writer_app.ico, calc_app.ico, impress_app.ico
- Update sidebar panel icon to OfficeLabs brand (lc_aideck.png + 32px variant)
- Update Sidebar.xcu to reference new lc_aideck icon instead of lc_basicideappear
- All icons converted from 1024x1024 source PNGs using PIL
- ICO files created with 256x256 primary size for taskbar compatibility
…eming

fix: use theme-aware colors in sidebar panel rendering
…ors()

Deck.cxx and TabBar.cxx had Color(0x28, 0x2A, 0x36) hardcoded for sidebar
backgrounds, ignoring the selected theme. Now uses GetOLColors().bg/surface
which reads from officelabs_theme.txt. Also fixed Theme.cxx bDark check to
treat midnight-blue as dark (was only checking for 'dark', not 'midnight-blue').
Replace generated simplified icons with proper Apple-style icons from
officelabs-core/officelabs-icons source assets:
- soffice.ico: Blue orbs with sparkle (main app)
- writer_app.ico: Blue document with text lines
- calc_app.ico: Green 3x3 grid
- impress_app.ico: Orange presentation board

All icons normalized to 512x512 canvas, PNG-encoded at 7 sizes
(16-256px), brightness and saturation boosted for taskbar clarity.
Replace GetDarkShadowColor/GetShadowColor with GetWindowTextColor for
ruler tick marks, numbers, indent markers, and tab stops. WindowTextColor
is designed to contrast with WindowColor (the ruler background), ensuring
proper visibility across light, dark, and midnight-blue themes.
Co-Authored-By: Pher
Replaces the default LibreOffice Colibre brand shell SVGs (about, logo,
logo-sc, and their _inverted variants) with the OfficeLabs wordmark:
teal diamond icon + 'OfficeLabs' text in Segoe UI/Helvetica.
Shifts surface colors from Dracula blue-tinted (#1A1B26, #282A36) to
pure neutral darks (#0F0F0F, #1A1A1A, #2A2A2A) and text to pure white.
Reduces teal/purple tint in backgrounds for a cleaner dark mode.
Theme switching via cefQuery is no longer needed — theme is now set at
startup via junction/env var rather than runtime IPC. Removes:
- handleSwitchTheme() method declaration and implementation (~90 lines)
- switchTheme dispatch in OnQuery
- Windows.h / XRestartManager includes pulled in only for that handler
…cleanup

brand + theme + CEF cleanup (3 commits)
…Services()

The first configmgr access at app.cxx:502
(officecfg::Setup::Office::OfficeRestartInProgress::get()) has no surrounding
try-catch. When Components::Components() throws a RuntimeException (e.g. due to
a corrupt or partially-written user profile on second cold launch), the exception
propagates uncaught through Desktop::Init() → InitVCL() → ImplSVMain() →
soffice_main(), killing the process silently before any window appears.

This is the root cause of the P0 profile-rewrite crash: wipe profile, first
launch OK (creates profile from scratch), second launch crashes before window.
--safe-mode bypasses configmgr init on the hot path, which is why it always
works.

Fix: wrap the three unprotected officecfg::get() calls in try/catch blocks that
route to SetBootstrapError(BE_OFFICECONFIG_BROKEN), allowing the existing safe-
mode recovery path to activate instead of dying silently.

- app.cxx: wrap lines 502-506 (OfficeRestartInProgress + FirstRun checks)
- appinit.cxx RegisterServices(): wrap ooSetupConnectionURL::get() and
  CreateTemporaryDirectory() (which re-throws RuntimeException from SvtPathOptions)
…ite-crash

fix: P0 profile-rewrite crash — catch configmgr RuntimeException in Desktop::Init/RegisterServices
… reach LO

Root cause: WebViewCefClient had no CefKeyboardHandler, so pressing F5 while
the AI sidebar had keyboard focus was consumed by CEF as a browser page-reload
instead of being dispatched to LibreOffice as .uno:Presentation.

Fix: add CefKeyboardHandler to WebViewCefClient.  OnPreKeyEvent intercepts
VK_F5 and VK_ESCAPE (with/without Shift), calls SetForegroundWindow on the LO
frame HWND, then PostMessage(WM_KEYDOWN) so the LO accelerator table fires.
All other keys pass through to CEF unchanged.

Acceptance criteria: F5 starts Impress fullscreen presentation, Shift+F5 starts
from current slide, Esc exits the running slideshow, no regression in
Writer/Calc (VK_F5/VK_ESCAPE are not bound there while sidebar is not focused).
@github-actions
Copy link
Copy Markdown

Thank you for your contribution. We use GitHub as a read-only mirror, so please submit your patch into our own code review system: https://wiki.documentfoundation.org/Development/GetInvolved

@github-actions github-actions Bot closed this May 25, 2026
@Pher217 Pher217 deleted the claude/2026-05-26-bug38-slideshow-fix branch May 25, 2026 15:36
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