summaryrefslogtreecommitdiff
path: root/src/core/bell.c
diff options
context:
space:
mode:
authorSteve Zesch <[email protected]>2012-05-10 13:08:46 -0700
committerSteve Zesch <[email protected]>2012-05-10 13:08:46 -0700
commitce3d3a4b6e0a93eea4d54ac4bc2907b7432e136b (patch)
tree81f0b3024b3440b881b9e61e165a93d23ca0b22d /src/core/bell.c
parent6e5c6ab190ca9bddf0e2b694abd0100ab5fcc11c (diff)
parente2d0da87ec3f7add9643c7f7f424df080d95d8dc (diff)
downloadmarco-ce3d3a4b6e0a93eea4d54ac4bc2907b7432e136b.tar.bz2
marco-ce3d3a4b6e0a93eea4d54ac4bc2907b7432e136b.tar.xz
Merge pull request #3 from benpicco/features
new marco features
Diffstat (limited to 'src/core/bell.c')
-rw-r--r--src/core/bell.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/core/bell.c b/src/core/bell.c
index 560b3569..efbfb7fd 100644
--- a/src/core/bell.c
+++ b/src/core/bell.c
@@ -300,10 +300,46 @@ meta_bell_notify (MetaDisplay *display,
if (window)
{
+ int x=-1, y=-1, width=-1, height=-1, screen_width=-1, screen_height=-1;
+ MetaScreen *screen;
+
+ screen = meta_window_get_screen (window);
+
ca_proplist_sets (p, CA_PROP_WINDOW_NAME, window->title);
ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long)window->xwindow);
+ ca_proplist_setf (p, CA_PROP_WINDOW_X11_SCREEN, "%i", meta_screen_get_screen_number(screen));
ca_proplist_sets (p, CA_PROP_APPLICATION_NAME, window->res_name);
ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d", window->net_wm_pid);
+
+ /* properties for positional sound based on window placement */
+ meta_window_get_geometry (window, &x, &y, &width, &height);
+ ca_proplist_setf (p, CA_PROP_WINDOW_X, "%i", x);
+ ca_proplist_setf (p, CA_PROP_WINDOW_Y, "%i", y);
+ ca_proplist_setf (p, CA_PROP_WINDOW_WIDTH, "%i", width);
+ ca_proplist_setf (p, CA_PROP_WINDOW_HEIGHT, "%i", height);
+
+ meta_screen_get_size (screen, &screen_width, &screen_height);
+ if (screen_width > 1)
+ {
+ x += width/2;
+ x = CLAMP(x, 0, screen_width-1);
+
+ /* From libcanberra-gtk.
+ * We use these strange format strings here to avoid that libc
+ * applies locale information on the formatting of floating
+ * numbers. */
+
+ ca_proplist_setf (p, CA_PROP_WINDOW_HPOS, "%i.%03i",
+ (int) (x/(screen_width-1)), (int) (1000.0*x/(screen_width-1)) % 1000);
+ }
+ if (screen_height > 1)
+ {
+ y += height/2;
+ y = CLAMP(y, 0, screen_height-1);
+
+ ca_proplist_setf (p, CA_PROP_WINDOW_VPOS, "%i.%03i",
+ (int) (y/(screen_height-1)), (int) (1000.0*y/(screen_height-1)) % 1000);
+ }
}
/* First, we try to play a real sound ... */