gtk-ng: only show OSD when mouse event isn't consumed
parent
23048dbd33
commit
1b1264e592
|
|
@ -1951,22 +1951,12 @@ pub const Surface = extern struct {
|
|||
const event = gesture.as(gtk.EventController).getCurrentEvent() orelse return;
|
||||
|
||||
const priv = self.private();
|
||||
if (priv.core_surface) |surface| {
|
||||
const surface = priv.core_surface orelse return;
|
||||
const gtk_mods = event.getModifierState();
|
||||
const button = translateMouseButton(gesture.as(gtk.GestureSingle).getCurrentButton());
|
||||
|
||||
// Trigger the on-screen keyboard if we have no selection.
|
||||
//
|
||||
// It's better to do this here rather than in the core callback
|
||||
// since we have direct access to the underlying gdk.Event here.
|
||||
if (button == .left and !surface.hasSelection()) {
|
||||
if (!self.showOnScreenKeyboard(event)) {
|
||||
log.warn("failed to activate the on-screen keyboard", .{});
|
||||
}
|
||||
}
|
||||
|
||||
const mods = gtk_key.translateMods(gtk_mods);
|
||||
_ = surface.mouseButtonCallback(
|
||||
const consumed = surface.mouseButtonCallback(
|
||||
.release,
|
||||
button,
|
||||
mods,
|
||||
|
|
@ -1974,6 +1964,16 @@ pub const Surface = extern struct {
|
|||
log.warn("error in key callback err={}", .{err});
|
||||
return;
|
||||
};
|
||||
|
||||
// Trigger the on-screen keyboard if we have no selection,
|
||||
// and that the mouse event hasn't been intercepted by the callback.
|
||||
//
|
||||
// It's better to do this here rather than within the core callback
|
||||
// since we have direct access to the underlying gdk.Event here.
|
||||
if (!consumed and button == .left and !surface.hasSelection()) {
|
||||
if (!self.showOnScreenKeyboard(event)) {
|
||||
log.warn("failed to activate the on-screen keyboard", .{});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue