[PATCH] Add sn_internal_display_get_screen_number ()

Julien Danjou julien at danjou.info
Thu Jan 29 06:37:38 PST 2009


Signed-off-by: Julien Danjou <julien at danjou.info>
---
 libsn/sn-common.c    |   14 ++++++++++++++
 libsn/sn-internals.h |    1 +
 libsn/sn-monitor.c   |    2 +-
 3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/libsn/sn-common.c b/libsn/sn-common.c
index 35fd6d7..6da3eed 100644
--- a/libsn/sn-common.c
+++ b/libsn/sn-common.c
@@ -170,6 +170,20 @@ sn_internal_display_get_root_window (SnDisplay *display,
 }
 
 /**
+ * sn_internal_display_get_screen_number:
+ * @display an #SnDisplay
+ *
+ *
+ *
+ * Return value: The number of screen for this #SnDisplay
+ **/
+int
+sn_internal_display_get_screen_number (SnDisplay *display)
+{
+    return display->n_screens;
+}
+
+/**
  * sn_display_process_event:
  * @display: a display
  * @xevent: X event
diff --git a/libsn/sn-internals.h b/libsn/sn-internals.h
index 5969a82..6466842 100644
--- a/libsn/sn-internals.h
+++ b/libsn/sn-internals.h
@@ -55,6 +55,7 @@ Screen*    sn_internal_display_get_x_screen    (SnDisplay              *display,
 
 Window     sn_internal_display_get_root_window (SnDisplay              *display,
                                                 int                     number);
+int        sn_internal_display_get_screen_number (SnDisplay *display);
 
 void       sn_internal_display_get_xmessage_data (SnDisplay              *display,
                                                   SnList                **funcs,
diff --git a/libsn/sn-monitor.c b/libsn/sn-monitor.c
index e2af250..d9a9e3a 100644
--- a/libsn/sn-monitor.c
+++ b/libsn/sn-monitor.c
@@ -782,7 +782,7 @@ xmessage_func (SnDisplay  *display,
                 {
                   int n;
                   n = atoi (values[i]);
-                  if (n >= 0 && n < ScreenCount (sn_display_get_x_display (sequence->display)))
+                  if (n >= 0 && n < sn_internal_display_get_screen_number (sequence->display))
                     {
                       sequence->screen = n;
                       changed = TRUE;
-- 
1.5.6.5



More information about the xdg mailing list