Coder Social home page Coder Social logo

magicwindow's Introduction

MagicWindow

A replacement for GtkWindow on X11 with better focus handling.

When running on X11, the GtkWindow widget uses an X window that adheres to the locally active focus model. This works fine most of the time. MagicWindow will address the times when GtkWindow doesn't work so well by using the globally active focus model.

MagicWindow is almost entirely identical to GtkWindow. The basic difference is that the X window used by the widget will have its input hint set to false. It should be possible to use MagicWindow as a drop-in replacement for GtkWindow, but for one caveat: the window manager will never focus the window directly, but will instead tell MagicWindow to take focus. The response of MagicWindow to the take focus message is the same as that of GtkWindow. (Is it? Haven't read the GtkWindow code recently.)

The idea behind the take focus message that the user has tried to focus a window in a way that the application owning the window would not otherwise know about. Keyboard navigation between windows is probably the most common kind of focus change that an application wouldn't otherwise know about. Window managers that frame windows should also send the take focus message for appropriate events on the frame window. (This is less common now thanks to "client-side decorations".) A window manager using pointer focus or sloppy focus would also send the take focus message for crossing events. Basically, an application should always set focus when it receives a take focus message. GtkWindow already does this (right?) and so will MagicWindow.

Most window managers send the take focus message even when, in click-to-focus mode, they detect button presses on a window. With those window managers, there will be no practical difference between MagicWindow and GtkWindow. This is an unfortunate design decision for window managers because it prevents the kind of focus handling which MagicWindow is made to support.

If an application using MagicWindow always sets focus to the window on a ButtonPress event, then it will be the same as an application using GtkWindow. What MagicWindow allows is pressing a mouse button in a window without focusing it. This is useful when the window is some kind of secondary window. A palette of tools, for example, would allow the user to select different tools without taking focus away from the main application window. An on-screen keyboard would leave focus wherever it is, rather than taking nonsensically taking keyboard focus for itself. A desktop feature like a panel could take clicks without taking focus. A window in the background with an active selection could allow a drag of that selection to start without taking focus from whatever application is on top.

Because MagicWindow doesn't always get focus in response to ButtonPress events, it's necessary to explicitly set focus for events that should set focus. If I can, I will make this the easy default behavior. I'm afraid making this the easy default will not be possible given how Gtk works.

magicwindow's People

Contributors

quodvideo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.