Skip to content

Commit

Permalink
add: Widget.click-through (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
end-4 authored Jan 14, 2024
1 parent 4939aea commit acb9fa5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/widgets/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk?version=3.0';
import GLib from 'gi://GLib?version=2.0';
import Gdk from 'gi://Gdk?version=3.0';
import Cairo from 'gi://cairo?version=1.0';
import Service, { kebabify, Props, BindableProps, Binding } from '../service.js';
import { registerGObject } from '../gobject.js';
import { interval } from '../utils.js';
Expand Down Expand Up @@ -83,6 +84,7 @@ export type BaseProps<Self extends Gtk.Widget, Props> = {
} & BindableProps<Props & {
class_name?: string
class_names?: string[]
click_through?: boolean
css?: string
hpack?: Align
vpack?: Align
Expand Down Expand Up @@ -217,6 +219,7 @@ export default function AgsWidget<
'cursor': ['string', 'rw'],
'is-destroyed': ['boolean', 'r'],
'attribute': ['jsobject', 'rw'],
'click-through': ['boolean', 'rw'],

// FIXME: deprecated
'properties': ['jsobject', 'w'],
Expand Down Expand Up @@ -492,5 +495,16 @@ export default function AgsWidget<

return x > 0 && x < w && y > 0 && y < h;
}

get click_through() { return !!this._get('click-through'); }
set click_through(clickThrough: boolean) {
if (this.click_through === clickThrough)
return;

const value = clickThrough ? new Cairo.Region : null;
this.input_shape_combine_region(value);
this._set('click-through', value);
this.notify('click-through');
}
};
}

0 comments on commit acb9fa5

Please sign in to comment.