---
title: "Godot: popup menu focus on X11 in C++ | VulCode"
description: "A fix in Godot Engine in C++: on X11, closing a submenu with a focused search bar returns focus to the parent popup menu, which reacts to clicks again."
url: "https://vulcode.com/en/opensource/contributions/godot"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/contributions)

godotengine/godot

# Godot Engine

An open source, multi-platform 2D and 3D game engine with its own editor, where game developers build scenes and interfaces.

[See the repository](https://github.com/godotengine/godot) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: C++
- **GitHub stars**: 120,623
- **Merged changes**: 1
- **Project site**: [godotengine.org](https://godotengine.org)

## What we changed

On X11 with embedded subwindows turned off, closing a submenu with an active search bar now returns focus to the parent menu, so it reacts to the mouse again.

### What this work shows

- X11 focus and override-redirect windows

- IME handling in popup windows

- An engine platform layer in C++

What was broken

### The parent menu stopped reacting to the mouse

With embed_subwindows off on X11, after closing a submenu whose search bar had focus, the PopupMenu no longer highlighted items or reacted to clicks. Popups are override-redirect windows, so focus went back to the main window instead of the parent menu.

How we fixed it

### Focus returns to the parent popup

grab_focus() cannot help here, because the window manager ignores _NET_ACTIVE_WINDOW for override-redirect windows. window_set_transient() therefore sets the input focus back on the parent popup when the closing popup held it through the IME.

[#124841](https://github.com/godotengine/godot/pull/124841)

## Merged change 1

- [#124841 Return X11 focus to parent popup when closing a nested popup with active IME Merged 27 October 2026](https://github.com/godotengine/godot/pull/124841)

## What it taught us

Where the engine, the X11 protocol and the window manager meet, the obvious fix can fail because the window manager ignores the activation request, so the first job is to find who really decides. The fix is small because it covers one precisely described case.

## Other projects we write code for

- [**Telegram Desktop** C++ · 33,661 stars The official desktop client of the Telegram messenger, written in C++ on the Telegram API and the MTProto protocol.](https://vulcode.com/en/opensource/contributions/telegram-desktop)

- [**Audacity** C++ · 19,148 stars A free, open source audio editor and recorder, used for recording and editing audio on Windows, macOS and Linux.](https://vulcode.com/en/opensource/contributions/audacity)

- [**Blender** C++ The free and open source 3D creation suite: modelling, animation, rendering and editing. The code is developed on projects.blender.org, and GitHub only mirrors it.](https://vulcode.com/en/opensource/contributions/blender)

- [**Node.js** JavaScript · 123,955 stars The JavaScript runtime built on V8 that runs servers, command line tools and front-end build pipelines. It ships a built-in node:sqlite module for working with SQLite databases.](https://vulcode.com/en/opensource/contributions/nodejs)

- [**Material UI** JavaScript · 99,391 stars A React component library that implements Google's Material Design: ready-made text fields, selects, buttons and other interface elements.](https://vulcode.com/en/opensource/contributions/material-ui)

- [**Zed** Rust · 95,562 stars A fast code editor in Rust from the creators of Atom and Tree-sitter, with live multiplayer editing.](https://vulcode.com/en/opensource/contributions/zed)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
