[MetaWindow] Make user-time a GObject property

Notification of changes are useful for code ordering windows.
This commit is contained in:
Colin Walters 2009-08-31 12:06:53 -04:00
parent 326110e38d
commit 84dc1c1b85

View File

@ -136,7 +136,8 @@ enum {
PROP_MINI_ICON, PROP_MINI_ICON,
PROP_DECORATED, PROP_DECORATED,
PROP_FULLSCREEN, PROP_FULLSCREEN,
PROP_WINDOW_TYPE PROP_WINDOW_TYPE,
PROP_USER_TIME
}; };
enum enum
@ -202,6 +203,9 @@ meta_window_get_property(GObject *object,
case PROP_WINDOW_TYPE: case PROP_WINDOW_TYPE:
g_value_set_enum (value, win->type); g_value_set_enum (value, win->type);
break; break;
case PROP_USER_TIME:
g_value_set_uint (value, win->net_wm_user_time);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -280,6 +284,16 @@ meta_window_class_init (MetaWindowClass *klass)
META_WINDOW_NORMAL, META_WINDOW_NORMAL,
G_PARAM_READABLE)); G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_USER_TIME,
g_param_spec_uint ("user-time",
"User time",
"Timestamp of last user interaction",
0,
G_MAXUINT,
0,
G_PARAM_READABLE));
window_signals[WORKSPACE_CHANGED] = window_signals[WORKSPACE_CHANGED] =
g_signal_new ("workspace-changed", g_signal_new ("workspace-changed",
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
@ -8514,6 +8528,8 @@ meta_window_set_user_time (MetaWindow *window,
__window_is_terminal (window)) __window_is_terminal (window))
window->display->allow_terminal_deactivation = FALSE; window->display->allow_terminal_deactivation = FALSE;
} }
g_object_notify (G_OBJECT (window), "user-time");
} }
/* Sets the demands_attention hint on a window, but only /* Sets the demands_attention hint on a window, but only