[gnome-contacts/new-design] Add input only window to row
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/new-design] Add input only window to row
- Date: Mon, 12 Dec 2011 15:33:43 +0000 (UTC)
commit 53281ec6eed4d2bb9b0c70fa06ed7eab042d04ad
Author: Alexander Larsson <alexl redhat com>
Date: Mon Dec 12 15:16:09 2011 +0100
Add input only window to row
src/contacts-row.vala | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-row.vala b/src/contacts-row.vala
index b18bc36..2411ab5 100644
--- a/src/contacts-row.vala
+++ b/src/contacts-row.vala
@@ -227,6 +227,7 @@ public class Contacts.Row : Container {
Widget? widget;
}
+ private Gdk.Window event_window;
RowGroup group;
int n_rows;
Child[,] row_children;
@@ -243,6 +244,44 @@ public class Contacts.Row : Container {
row_children = new Child[group.n_columns, n_rows];
}
+ public override void realize () {
+ Allocation allocation;
+ get_allocation (out allocation);
+ set_realized (true);
+
+ Gdk.WindowAttr attributes = { };
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
+ attributes.window_type = Gdk.WindowType.CHILD;
+ attributes.event_mask = this.get_events () | Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.ENTER_NOTIFY_MASK | Gdk.EventMask.LEAVE_NOTIFY_MASK;
+
+ var window = get_parent_window ();
+ this.set_window (window);
+
+ attributes.wclass = Gdk.WindowWindowClass.ONLY;
+ event_window = new Gdk.Window (window, attributes, Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y);
+ event_window.set_user_data (this);
+ }
+
+ public override void unrealize () {
+ event_window.set_user_data (null);
+ event_window.destroy ();
+ event_window = null;
+ base.unrealize ();
+ }
+
+ public override void map () {
+ event_window.show ();
+ base.map ();
+ }
+
+ public override void unmap () {
+ event_window.hide ();
+ base.unmap ();
+ }
+
public void attach (Widget widget, int attach_col, int attach_row) {
if (attach_col >= group.n_columns) {
warning ("Tryint to attach widget to non-existing column");
@@ -478,6 +517,12 @@ public class Contacts.Row : Container {
set_allocation (allocation);
+ if (event_window != null)
+ event_window.move_resize (allocation.x,
+ allocation.y,
+ allocation.width,
+ allocation.height);
+
int y = 0;
for (int row = 0; row < n_rows; row ++) {
int x = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]