patches/libwnck-01-trusted-extensions.diff
author yippi
Mon, 27 Sep 2010 21:07:51 +0000
changeset 20108 51df67ca9307
parent 17793 208207fdc93f
child 20201 33ac0296e01d
child 21593 2d1a4d25db41
permissions -rw-r--r--
I had these modules listed as being owned by me, but they are really owned by wangke, correcting.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
     1
diff -urN libwnck.orig/config.h.in libwnck.new/config.h.in
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
     2
--- libwnck.orig/config.h.in	2008-08-06 23:43:14.009985000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
     3
+++ libwnck.new/config.h.in	2008-08-06 23:43:40.045900000 +0100
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
     4
@@ -32,6 +32,7 @@
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
     5
 
11180
7f911e6f7c0e 2007-11-13 Damien Carbery <[email protected]>
dcarbery
parents: 10691
diff changeset
     6
 /* Define if you have libstartup-notification */
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
     7
 #undef HAVE_STARTUP_NOTIFICATION
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
     8
+#undef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
     9
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    10
 /* Define to 1 if you have the <stdint.h> header file. */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    11
 #undef HAVE_STDINT_H
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
    12
diff -urN libwnck.orig/configure.in libwnck.new/configure.in
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
    13
--- libwnck.orig/configure.in	2008-08-06 23:43:14.618321000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
    14
+++ libwnck.new/configure.in	2008-08-06 23:43:40.049192000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
    15
@@ -139,6 +139,15 @@
11190
9d26aa552b8f 2007-11-14 Damien Carbery <[email protected]>
dcarbery
parents: 11180
diff changeset
    16
 dnl Honor ACLOCAL_FLAGS for --enable-maintainer-mode
9d26aa552b8f 2007-11-14 Damien Carbery <[email protected]>
dcarbery
parents: 11180
diff changeset
    17
 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    18
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    19
+case "$host" in
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    20
+    *-*-solaris*)
11180
7f911e6f7c0e 2007-11-13 Damien Carbery <[email protected]>
dcarbery
parents: 10691
diff changeset
    21
+        AC_CHECK_HEADERS(X11/extensions/Xtsol.h sys/tsol/label_macro.h libgnometsol/userattr.h,
7f911e6f7c0e 2007-11-13 Damien Carbery <[email protected]>
dcarbery
parents: 10691
diff changeset
    22
+          AC_DEFINE(HAVE_XTSOL, , [Building with XTSOL support]))
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    23
+        ;;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    24
+    *)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    25
+        ;;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    26
+esac
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    27
+
11190
9d26aa552b8f 2007-11-14 Damien Carbery <[email protected]>
dcarbery
parents: 11180
diff changeset
    28
 ##################################################
9d26aa552b8f 2007-11-14 Damien Carbery <[email protected]>
dcarbery
parents: 11180
diff changeset
    29
 # Checks for gtk-doc and docbook-tools
9d26aa552b8f 2007-11-14 Damien Carbery <[email protected]>
dcarbery
parents: 11180
diff changeset
    30
 ##################################################
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
    31
diff -urN libwnck.orig/libwnck/pager.c libwnck.new/libwnck/pager.c
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
    32
--- libwnck.orig/libwnck/pager.c	2008-08-06 23:43:13.356087000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
    33
+++ libwnck.new/libwnck/pager.c	2008-08-06 23:43:40.066590000 +0100
11201
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
    34
@@ -29,6 +29,7 @@
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
    35
 #include <math.h>
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
    36
 #include <glib/gi18n-lib.h>
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    37
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    38
+#include <config.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    39
 #include "pager.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    40
 #include "workspace.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    41
 #include "window.h"
11201
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
    42
@@ -59,6 +60,11 @@
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
    43
  * layout.
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
    44
  */
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    45
 
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    46
+#ifdef HAVE_XTSOL
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    47
+#include "trusted-tooltips.h"
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    48
+#include "wnck-tsol.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    49
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    50
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    51
 #define N_SCREEN_CONNECTIONS 11
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    52
 
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    53
 struct _WnckPagerPrivate
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
    54
@@ -82,6 +88,9 @@
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    55
   WnckWindow *drag_window;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    56
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    57
   GdkPixbuf *bg_cache;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    58
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    59
+  TrustedTooltips *tooltips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    60
+#endif /* HAVE_XTSOL */  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    61
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    62
   int layout_manager_token;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    63
 
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
    64
@@ -345,8 +354,8 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    65
   attributes.colormap = gtk_widget_get_colormap (widget);
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    66
   attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK |
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    67
 	  		  GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    68
-			  GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK |
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    69
-			  GDK_POINTER_MOTION_HINT_MASK;
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    70
+			  GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    71
+			  GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    72
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    73
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    74
 
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
    75
@@ -1237,6 +1257,53 @@
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    76
       cairo_stroke (cr);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    77
       cairo_destroy (cr);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    78
     }
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    79
+#ifdef HAVE_XTSOL
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    80
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    81
+      #define DEFAULT_COLOR	"white"
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
    82
+      const char *label = NULL;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    83
+      char *colorname;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    84
+      int error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    85
+      GdkColor label_color;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    86
+      m_label_t *mlabel = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    87
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    88
+      if (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    89
+	{
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
    90
+          label = wnck_workspace_get_label (wnck_screen_get_workspace(pager->priv->screen, workspace));
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
    91
+	  if (label != NULL && (libtsol_str_to_label (label, &mlabel, MAC_LABEL, L_NO_CORRECTION, &error) == 0)) 
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    92
+	  {
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    93
+		  cairo_t *cr; 
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    94
+		  cr = gdk_cairo_create (widget->window);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    95
+
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    96
+		  libtsol_label_to_str (mlabel, &colorname, M_COLOR, DEF_NAMES);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    97
+
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    98
+		  if (colorname == NULL)
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
    99
+			  colorname = g_strdup(DEFAULT_COLOR);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   100
+
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   101
+		  gdk_color_parse ((const char*)colorname, &label_color);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   102
+
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   103
+		  g_free (colorname);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   104
+
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   105
+		  cairo_set_source_rgba (cr,
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   106
+				  (double) label_color.red / 65535,
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   107
+				  (double) label_color.green / 65535,
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   108
+				  (double) label_color.blue / 65535,
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   109
+				  0.5);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   110
+		  cairo_set_line_width (cr, 1.0);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   111
+		  cairo_rectangle (cr,
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   112
+				  rect->x + 0.5, rect->y + 0.5,
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   113
+				  rect->width - 1, rect->height - 1);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   114
+		  cairo_fill (cr);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   115
+		  cairo_destroy (cr);
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   116
+	  }
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   117
+	  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   118
+	    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   119
+	      g_warning("Could not validate sensitivity label \"%s\"", label ? label : "no label defined");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   120
+	    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   121
+	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   122
+	  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   123
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   124
+#endif /*HAVE_XTSOL*/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   125
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   126
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   127
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   128
 static gboolean
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   129
@@ -1940,6 +2015,14 @@
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   130
   WnckPager *pager;
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   131
   
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   132
   pager = g_object_new (WNCK_TYPE_PAGER, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   133
+#ifdef HAVE_XTSOL  
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   134
+  if (_wnck_use_trusted_extensions () == TRUE) {
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   135
+    pager->priv->tooltips = trusted_tooltips_new ();
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   136
+    trusted_tooltips_set_pager (pager->priv->tooltips, pager);
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   137
+    gtk_object_ref (GTK_OBJECT (pager->priv->tooltips));
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   138
+    gtk_object_sink (GTK_OBJECT (pager->priv->tooltips));
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   139
+  }
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   140
+#endif /* HAVE_XTSOL */  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   141
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   142
   return GTK_WIDGET (pager);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   143
 }
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   144
diff -urN libwnck.orig/libwnck/private.h libwnck.new/libwnck/private.h
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   145
--- libwnck.orig/libwnck/private.h	2008-08-06 23:43:13.349065000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   146
+++ libwnck.new/libwnck/private.h	2008-08-06 23:43:40.073263000 +0100
11201
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
   147
@@ -35,6 +35,9 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   148
 #ifdef HAVE_STARTUP_NOTIFICATION
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   149
 #include <libsn/sn.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   150
 #endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   151
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   152
+#include <tsol/label.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   153
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   154
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   155
 G_BEGIN_DECLS
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   156
 
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   157
@@ -102,9 +105,23 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   158
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   159
 void _wnck_workspace_update_name (WnckWorkspace *workspace,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   160
                                   const char    *name);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   161
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   162
+void _wnck_workspace_update_label (WnckWorkspace *workspace,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   163
+                                   const char    *label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   164
+void _wnck_workspace_update_role (WnckWorkspace *workspace,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   165
+                                  const char    *role);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   166
+blrange_t * _wnck_workspace_get_range (WnckWorkspace *space);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   167
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   168
 void _wnck_screen_change_workspace_name (WnckScreen *screen,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   169
                                          int         number,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   170
                                          const char *name);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   171
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   172
+void _wnck_screen_change_workspace_label (WnckScreen *screen,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   173
+                                          int         number,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   174
+                                          const char *label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   175
+gboolean _wnck_check_xtsol_extension    ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   176
+gboolean _wnck_use_trusted_extensions	();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   177
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   178
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   179
 gboolean _wnck_workspace_set_geometry (WnckWorkspace *space, int w, int h);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   180
 gboolean _wnck_workspace_set_viewport (WnckWorkspace *space, int x, int y);
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   181
diff -urN libwnck.orig/libwnck/screen.c libwnck.new/libwnck/screen.c
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   182
--- libwnck.orig/libwnck/screen.c	2008-08-06 23:43:13.472108000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   183
+++ libwnck.new/libwnck/screen.c	2008-08-06 23:43:40.084085000 +0100
11201
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
   184
@@ -33,11 +33,17 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   185
 #include "class-group.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   186
 #include "xutils.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   187
 #include "private.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   188
+#include "wnck-tsol.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   189
 #include <gdk/gdk.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   190
 #include <gdk/gdkx.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   191
 #include <string.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   192
 #include <stdlib.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   193
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   194
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   195
+#include <tsol/label.h>
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
   196
+#include <sys/tsol/label_macro.h> 
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   197
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   198
+
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   199
 /**
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   200
  * SECTION:screen
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   201
  * @short_description: an object representing a screen.
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   202
@@ -122,6 +128,10 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   203
   guint need_update_active_window : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   204
   guint need_update_workspace_layout : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   205
   guint need_update_workspace_names : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   206
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   207
+  guint need_update_workspace_labels : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   208
+  guint need_update_workspace_roles : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   209
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   210
   guint need_update_bg_pixmap : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   211
   guint need_update_showing_desktop : 1;
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   212
   guint need_update_wm : 1;
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   213
@@ -160,6 +170,10 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   214
 static void update_active_window      (WnckScreen      *screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   215
 static void update_workspace_layout   (WnckScreen      *screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   216
 static void update_workspace_names    (WnckScreen      *screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   217
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   218
+static void update_workspace_labels   (WnckScreen      *screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   219
+static void update_workspace_roles    (WnckScreen      *screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   220
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   221
 static void update_showing_desktop    (WnckScreen      *screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   222
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   223
 static void queue_update            (WnckScreen      *screen);
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   224
@@ -602,6 +616,10 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   225
   screen->priv->need_update_active_window = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   226
   screen->priv->need_update_workspace_layout = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   227
   screen->priv->need_update_workspace_names = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   228
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   229
+  screen->priv->need_update_workspace_labels = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   230
+  screen->priv->need_update_workspace_roles = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   231
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   232
   screen->priv->need_update_bg_pixmap = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   233
   screen->priv->need_update_showing_desktop = TRUE;
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   234
   screen->priv->need_update_wm = TRUE;
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   235
@@ -1124,6 +1142,20 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   236
       screen->priv->need_update_workspace_names = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   237
       queue_update (screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   238
     }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   239
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   240
+  else if (xevent->xproperty.atom ==
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   241
+           _wnck_atom_get ("_NET_DESKTOP_LABELS"))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   242
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   243
+      screen->priv->need_update_workspace_labels = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   244
+      queue_update (screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   245
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   246
+  else if (xevent->xproperty.atom ==
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   247
+           _wnck_atom_get ("_NET_DESKTOP_ROLES"))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   248
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   249
+      screen->priv->need_update_workspace_roles = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   250
+      queue_update (screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   251
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   252
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   253
   else if (xevent->xproperty.atom ==
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   254
            _wnck_atom_get ("_XROOTPMAP_ID"))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   255
     {
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   256
@@ -2220,6 +2252,85 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   257
   g_list_free (copy);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   258
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   259
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   260
+#ifdef  HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   261
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   262
+update_workspace_labels (WnckScreen *screen)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   263
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   264
+  char **labels;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   265
+  int i;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   266
+  GList *tmp;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   267
+  GList *copy;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   268
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   269
+  if (!screen->priv->need_update_workspace_labels)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   270
+    return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   271
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   272
+  screen->priv->need_update_workspace_labels = FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   273
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   274
+  labels = _wnck_get_utf8_list (screen->priv->xroot,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   275
+                                _wnck_atom_get ("_NET_DESKTOP_LABELS"));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   276
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   277
+  copy = g_list_copy (screen->priv->workspaces);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   278
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   279
+  i = 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   280
+  tmp = copy;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   281
+  while (tmp != NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   282
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   283
+      if (labels && labels[i])
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   284
+        {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   285
+          _wnck_workspace_update_label (tmp->data, labels[i]);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   286
+          ++i;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   287
+        }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   288
+      else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   289
+        _wnck_workspace_update_label (tmp->data, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   290
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   291
+      tmp = tmp->next;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   292
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   293
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   294
+  g_strfreev (labels);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   295
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   296
+  g_list_free (copy);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   297
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   298
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   299
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   300
+update_workspace_roles (WnckScreen *screen)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   301
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   302
+  char **roles;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   303
+  int i;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   304
+  GList *tmp;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   305
+  GList *copy;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   306
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   307
+  if (!screen->priv->need_update_workspace_roles)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   308
+    return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   309
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   310
+  screen->priv->need_update_workspace_roles = FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   311
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   312
+  roles = _wnck_get_utf8_list (screen->priv->xroot,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   313
+                                _wnck_atom_get ("_NET_DESKTOP_ROLES"));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   314
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   315
+  copy = g_list_copy (screen->priv->workspaces);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   316
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   317
+  i = 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   318
+  tmp = copy;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   319
+  while (tmp != NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   320
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   321
+      if (roles && roles[i])
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   322
+        {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   323
+          _wnck_workspace_update_role (tmp->data, roles[i]);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   324
+          ++i;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   325
+        }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   326
+      else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   327
+        _wnck_workspace_update_role (tmp->data, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   328
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   329
+      tmp = tmp->next;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   330
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   331
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   332
+  g_strfreev (roles);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   333
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   334
+  g_list_free (copy);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   335
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   336
+#endif /* HAVE_XTSOL */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   337
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   338
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   339
 static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   340
 update_bg_pixmap (WnckScreen *screen)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   341
 {
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   342
@@ -2305,6 +2416,10 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   343
     {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   344
       screen->priv->need_update_viewport_settings = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   345
       screen->priv->need_update_workspace_names = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   346
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   347
+      screen->priv->need_update_workspace_labels = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   348
+      screen->priv->need_update_workspace_roles = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   349
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   350
     }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   351
       
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   352
   /* First get our big-picture state in order */
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   353
@@ -2317,6 +2432,15 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   354
   update_active_window (screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   355
   update_workspace_layout (screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   356
   update_workspace_names (screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   357
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   358
+  /* IMPORTANT
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   359
+   * Workspace roles MUST be set before labels 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   360
+   * as the valid label range for role workspaces
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   361
+   * is different from the user's min and max label
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   362
+   */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   363
+  update_workspace_roles (screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   364
+  update_workspace_labels (screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   365
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   366
   update_showing_desktop (screen);
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   367
   update_wm (screen);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   368
   
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   369
@@ -2815,3 +2939,86 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   370
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   371
   g_free (names);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   372
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   373
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   374
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   375
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   376
+_wnck_screen_change_workspace_label (WnckScreen *screen,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   377
+                                    int         number,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   378
+                                    const char *label)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   379
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   380
+  int n_spaces;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   381
+  char **labels;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   382
+  int i;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   383
+  int error=-2;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   384
+  m_label_t *mlabel = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   385
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   386
+  static char		*lower_sl_str = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   387
+  static char		*upper_clear_str = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   388
+  static blrange_t	*workspace_range = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   389
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   390
+  WnckWorkspace		*tmp_space = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   391
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   392
+  /* First check that we are running in a trusted windowing environment */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   393
+  if (! _wnck_check_xtsol_extension ()) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   394
+      g_warning("Workspace labelling can not work with out the SUN_TSOL X extension");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   395
+      return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   396
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   397
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   398
+  if (!_wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   399
+      return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   400
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   401
+  /* 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   402
+   * Label must be validated.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   403
+   * Convert the label string to a binary MAC_LABEL type.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   404
+   * Then check that it is in the workspace's range which 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   405
+   * depends on what role (if any) the workspace has.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   406
+   */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   407
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   408
+  if (libtsol_str_to_label (label, &mlabel, MAC_LABEL, L_NO_CORRECTION, &error) < 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   409
+      g_warning("Could not validate sensitivity label \"%s\"", label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   410
+      return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   411
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   412
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   413
+  tmp_space = wnck_screen_get_workspace (screen, number);
11201
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
   414
+  /* need to refresh the role cache if an app is calling change label 
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
   415
+   * after setting directly the _NET_DESKTOP_ROLES as this wouldn't have been 
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
   416
+   * updated in libwnck yet */
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
   417
+  screen->priv->need_update_workspace_roles = TRUE;
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
   418
+  update_workspace_roles (screen); 
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
   419
+   workspace_range = _wnck_workspace_get_range (tmp_space);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   420
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   421
+  if (!libtsol_blinrange (mlabel, workspace_range)) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   422
+      g_warning("Could not change the sensitivity label of workspace %d because \"%s\" "
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   423
+                "appears to be outside of the workspace's label range", number, label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   424
+      libtsol_m_label_free (mlabel);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   425
+      return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   426
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   427
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   428
+  n_spaces = wnck_screen_get_workspace_count (screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   429
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   430
+  labels = g_new0 (char*, n_spaces + 1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   431
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   432
+  i = 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   433
+  while (i < n_spaces) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   434
+      if (i == number)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   435
+          labels[i] = (char*) label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   436
+      else {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   437
+          WnckWorkspace *workspace;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   438
+          workspace = wnck_screen_get_workspace (screen, i);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   439
+          if (workspace) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   440
+              labels[i] = (char*) wnck_workspace_get_label (workspace);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   441
+              if (labels[i] == NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   442
+                  labels[i] = (char*) ""; /* Maybe a g_warning too ? */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   443
+          } else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   444
+              labels[i] = (char*) ""; /* maybe this should be a g_warning too */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   445
+      }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   446
+      i++;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   447
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   448
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   449
+  _wnck_set_utf8_list (screen->priv->xroot,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   450
+                       _wnck_atom_get ("_NET_DESKTOP_LABELS"),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   451
+                       labels);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   452
+  libtsol_m_label_free (mlabel);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   453
+  g_free (labels);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   454
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   455
+#endif /* HAVE_XTSOL */
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   456
diff -urN libwnck.orig/libwnck/tasklist.c libwnck.new/libwnck/tasklist.c
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   457
--- libwnck.orig/libwnck/tasklist.c	2008-08-06 23:43:13.368589000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   458
+++ libwnck.new/libwnck/tasklist.c	2008-08-06 23:43:40.101354000 +0100
11201
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
   459
@@ -36,6 +36,10 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   460
 #include "workspace.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   461
 #include "xutils.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   462
 #include "private.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   463
+#ifdef HAVE_XTSOL 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   464
+#include "wnck-tsol.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   465
+#include "trusted-tooltips.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   466
+#endif /* HAVE_XTSOL */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   467
 
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   468
 /**
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   469
  * SECTION:tasklist
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   470
@@ -200,6 +204,10 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   471
   GHashTable *class_group_hash;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   472
   GHashTable *win_hash;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   473
   
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   474
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   475
+  TrustedTooltips *tooltips;
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   476
+#endif /*HAVE_XTSOL*/   
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   477
+
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   478
   gint max_button_width;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   479
   gint max_button_height;
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   480
 
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   481
@@ -2123,6 +2131,10 @@
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   482
   WnckTasklist *tasklist;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   483
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   484
   tasklist = g_object_new (WNCK_TYPE_TASKLIST, NULL);
9890
d929dccb218b Commit libwnck-01 TX patch mentioned in ChangeLog.
dcarbery
parents: 9275
diff changeset
   485
+#ifdef HAVE_XTSOL
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   486
+  if (_wnck_use_trusted_extensions () == TRUE)
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   487
+    tasklist->priv->tooltips = trusted_tooltips_new ();
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   488
+#endif /*HAVE_XTSOL*/
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   489
 
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   490
   return GTK_WIDGET (tasklist);
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
   491
 }
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   492
@@ -2960,6 +2972,10 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   493
 	{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   494
 	  image = gtk_image_new_from_pixbuf (pixbuf);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   495
 	  gtk_widget_show (image);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   496
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   497
+      if (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   498
+	image = window_menu_create_label_indicator (win_task->window, image);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   499
+#endif /*HAVE_XTSOL*/	  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   500
 	  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   501
 					 image);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   502
 	  g_object_unref (pixbuf);
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   503
@@ -3352,6 +3368,15 @@
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   504
   text = wnck_task_get_text (task, TRUE, TRUE);
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   505
   if (text != NULL)
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   506
     {
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   507
+#ifdef HAVE_XTSOL
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   508
+    if (_wnck_use_trusted_extensions () == TRUE)
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   509
+        trusted_tooltips_set_tip (task->tasklist->priv->tooltips,
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   510
+                                task->button,
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   511
+                                 text,
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   512
+                                 task->window ? wnck_window_get_label_human_readable (task->window) : "",
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   513
+                                 task->window ? wnck_window_get_label_color (task->window) : NULL,
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   514
+                                 NULL);
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   515
+#endif /* HAVE_XTSOL */
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   516
       gtk_label_set_text (GTK_LABEL (task->label), text);
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   517
       if (wnck_task_get_needs_attention (task))
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   518
         {
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   519
@@ -3812,7 +3837,24 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   520
   g_free (text);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   521
   
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   522
   text = wnck_task_get_text (task, FALSE, FALSE);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   523
+#ifdef HAVE_XTSOL
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   524
+  if (_wnck_use_trusted_extensions () == TRUE)
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   525
+    {
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   526
+      if (task->window)
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   527
+        {
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   528
+         trusted_tooltips_set_tip (task->tasklist->priv->tooltips,
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   529
+                                   task->button,
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   530
+                                   text,
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   531
+                                   wnck_window_get_label_human_readable (task->window),
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   532
+                                   wnck_window_get_label_color (task->window),
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   533
+                                   NULL);
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   534
+        }
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   535
+    else
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   536
+      trusted_tooltips_set_tip (task->tasklist->priv->tooltips, task->button, text, "Hum No Label", NULL, NULL);
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   537
+  }
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   538
+#else
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   539
   gtk_widget_set_tooltip_text (task->button, text);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   540
+#endif /*HAVE_XTSOL*/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   541
   g_free (text);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   542
   
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   543
   /* Set up signals */
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   544
@@ -4182,6 +4224,48 @@
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   545
 #endif
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   546
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   547
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   548
+#ifdef HAVE_XTSOL
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   549
+static void
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   550
+draw_trusted_label (GtkWidget* widget, WnckTask *task)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   551
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   552
+  GtkStyle *style;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   553
+  int x_offset;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   554
+  ConstraintImage *cimage;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   555
+  GdkRectangle area;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   556
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   557
+  style = task->button->style;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   558
+  /* get the width of the icon and the padding */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   559
+  x_offset = task->image->allocation.width + (style->xthickness *2);
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   560
+
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   561
+  area.x = widget->allocation.x + x_offset;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   562
+  area.y = widget->allocation.y + 2;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   563
+  area.width = widget->allocation.width - x_offset;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   564
+  area.height = task->label->allocation.y -task->button->allocation.y;
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   565
+
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   566
+  cimage = get_highlight_stripe ((char*)wnck_window_get_label (task->window),
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   567
+                                wnck_window_get_label_color (task->window));
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   568
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   569
+  if (cimage)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   570
+    libgnome_tsol_constraint_image_render (cimage, widget->window,
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   571
+                                          NULL, &area,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   572
+                                          FALSE,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   573
+                                          area.x,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   574
+                                          area.y,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   575
+                                          area.width,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   576
+                                          area.height);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   577
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   578
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   579
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   580
+gboolean
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   581
+wnck_task_class_expose (GtkWidget        *widget,
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   582
+                       GdkEventExpose   *event,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   583
+                       gpointer          data)
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   584
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   585
+  draw_trusted_label (widget, (WnckTask*) data);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   586
+  return FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   587
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   588
+#endif /* HAVE_XTSOL */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   589
+
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   590
 static WnckTask *
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   591
 wnck_task_new_from_window (WnckTasklist *tasklist,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   592
 			   WnckWindow   *window)
12160
312324ec0762 2008-04-18 Niall Power <[email protected]>
niall
parents: 11201
diff changeset
   593
@@ -4197,6 +4281,14 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   594
   
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   595
   wnck_task_create_widgets (task, tasklist->priv->relief);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   596
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   597
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   598
+  if (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   599
+    g_signal_connect_object (task->button, "expose_event",
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   600
+                            G_CALLBACK (wnck_task_class_expose),
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   601
+                            G_OBJECT (task),
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   602
+                            G_CONNECT_AFTER);
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
   603
+#endif /* HAVE_XTSOL */
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   604
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   605
   remove_startup_sequences_for_window (tasklist, window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   606
   
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   607
   return task;
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   608
diff -urN libwnck.orig/libwnck/trusted-tooltips.c libwnck.new/libwnck/trusted-tooltips.c
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   609
--- libwnck.orig/libwnck/trusted-tooltips.c	1970-01-01 01:00:00.000000000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
   610
+++ libwnck.new/libwnck/trusted-tooltips.c	2008-08-06 23:43:40.105541000 +0100
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   611
@@ -0,0 +1,916 @@
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   612
+/* GTK - The GIMP Toolkit
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   613
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   614
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   615
+ * This library is free software; you can redistribute it and/or
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   616
+ * modify it under the terms of the GNU Lesser General Public
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   617
+ * License as published by the Free Software Foundation; either
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   618
+ * version 2 of the License, or (at your option) any later version.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   619
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   620
+ * This library is distributed in the hope that it will be useful,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   621
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   622
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   623
+ * Lesser General Public License for more details.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   624
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   625
+ * You should have received a copy of the GNU Lesser General Public
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   626
+ * License along with this library; if not, write to the
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   627
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   628
+ * Boston, MA 02111-1307, USA.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   629
+ */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   630
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   631
+/*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   632
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   633
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   634
+ * files for a list of changes.  These files are distributed with
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   635
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   636
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   637
+ * Modified for trusted JDS by Erwann Chenede - <[email protected]> 2005
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   638
+ * Copyright (C) Sun Microsystems 2005 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   639
+ */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   640
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   641
+#include <config.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   642
+#include <stdlib.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   643
+#include <string.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   644
+#include <stdio.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   645
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   646
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   647
+#include "trusted-tooltips.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   648
+#include "workspace.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   649
+#include <wnck-tsol.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   650
+#include <gtk/gtk.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   651
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   652
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   653
+#define DEFAULT_DELAY 500           /* Default delay in ms */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   654
+#define STICKY_DELAY 0              /* Delay before popping up next tip
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   655
+                                     * if we're sticky
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   656
+                                     */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   657
+#define STICKY_REVERT_DELAY 1000    /* Delay before sticky tooltips revert
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   658
+				     * to normal
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   659
+                                     */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   660
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   661
+static void trusted_tooltips_class_init        (TrustedTooltipsClass *klass);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   662
+static void trusted_tooltips_init              (TrustedTooltips      *tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   663
+static void trusted_tooltips_destroy           (GtkObject        *object);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   664
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   665
+static void trusted_tooltips_event_handler     (GtkWidget   *widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   666
+                                            GdkEvent    *event);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   667
+static void trusted_tooltips_widget_unmap      (GtkWidget   *widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   668
+                                            gpointer     data);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   669
+static void trusted_tooltips_widget_remove     (GtkWidget   *widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   670
+                                            gpointer     data);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   671
+static void trusted_tooltips_set_active_widget (TrustedTooltips *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   672
+                                            GtkWidget   *widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   673
+static gint trusted_tooltips_timeout           (gpointer     data);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   674
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   675
+static gint trusted_tooltips_paint_window      (TrustedTooltips *tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   676
+static void trusted_tooltips_draw_tips         (TrustedTooltips *tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   677
+static void trusted_tooltips_unset_tip_window  (TrustedTooltips *tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   678
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   679
+static gboolean get_keyboard_mode          (GtkWidget   *widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   680
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   681
+static GtkObjectClass *parent_class;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   682
+static const gchar  tooltips_data_key[] = "_TrustedTooltipsData";
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   683
+static const gchar  tooltips_info_key[] = "_TrustedTooltipsInfo";
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   684
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   685
+GType
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   686
+trusted_tooltips_get_type (void)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   687
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   688
+  static GType tooltips_type = 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   689
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   690
+  if (!tooltips_type)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   691
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   692
+      static const GTypeInfo tooltips_info =
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   693
+      {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   694
+	sizeof (TrustedTooltipsClass),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   695
+	NULL,		/* base_init */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   696
+	NULL,		/* base_finalize */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   697
+	(GClassInitFunc) trusted_tooltips_class_init,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   698
+	NULL,		/* class_finalize */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   699
+	NULL,		/* class_data */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   700
+	sizeof (TrustedTooltips),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   701
+	0,		/* n_preallocs */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   702
+	(GInstanceInitFunc) trusted_tooltips_init,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   703
+      };
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   704
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   705
+      tooltips_type = g_type_register_static (GTK_TYPE_OBJECT, "TrustedTooltips",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   706
+					      &tooltips_info, 0);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   707
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   708
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   709
+  return tooltips_type;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   710
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   711
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   712
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   713
+trusted_tooltips_class_init (TrustedTooltipsClass *class)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   714
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   715
+  GtkObjectClass *object_class;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   716
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   717
+  object_class = (GtkObjectClass*) class;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   718
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   719
+  parent_class = g_type_class_peek_parent (class);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   720
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   721
+  object_class->destroy = trusted_tooltips_destroy;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   722
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   723
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   724
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   725
+trusted_tooltips_init (TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   726
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   727
+  tooltips->tip_window = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   728
+  tooltips->active_tips_data = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   729
+  tooltips->tips_data_list = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   730
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   731
+  tooltips->delay = DEFAULT_DELAY;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   732
+  tooltips->enabled = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   733
+  tooltips->timer_tag = 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   734
+  tooltips->use_sticky_delay = FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   735
+  tooltips->last_popdown.tv_sec = -1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   736
+  tooltips->last_popdown.tv_usec = -1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   737
+  tooltips->pager = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   738
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   739
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   740
+TrustedTooltips *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   741
+trusted_tooltips_new (void)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   742
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   743
+  return g_object_new (TRUSTED_TOOLTIPS_TYPE, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   744
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   745
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   746
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   747
+trusted_tooltips_destroy_data (TrustedTooltipsData *tooltipsdata)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   748
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   749
+  g_free (tooltipsdata->tip_text);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   750
+  g_free (tooltipsdata->trusted_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   751
+  g_free (tooltipsdata->tip_private);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   752
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   753
+  g_signal_handlers_disconnect_by_func (tooltipsdata->widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   754
+				        (gpointer)trusted_tooltips_event_handler,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   755
+					tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   756
+  g_signal_handlers_disconnect_by_func (tooltipsdata->widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   757
+					(gpointer)trusted_tooltips_widget_unmap,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   758
+					tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   759
+  g_signal_handlers_disconnect_by_func (tooltipsdata->widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   760
+					(gpointer)trusted_tooltips_widget_remove,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   761
+					tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   762
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   763
+  g_object_set_data (G_OBJECT (tooltipsdata->widget), tooltips_data_key, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   764
+  g_object_unref (tooltipsdata->widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   765
+  g_free (tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   766
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   767
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   768
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   769
+tip_window_display_closed (GdkDisplay  *display,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   770
+			   gboolean     was_error,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   771
+			   TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   772
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   773
+  trusted_tooltips_unset_tip_window (tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   774
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   775
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   776
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   777
+disconnect_tip_window_display_closed (TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   778
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   779
+  g_signal_handlers_disconnect_by_func (gtk_widget_get_display (tooltips->tip_window),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   780
+					(gpointer) tip_window_display_closed,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   781
+					tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   782
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   783
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   784
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   785
+trusted_tooltips_unset_tip_window (TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   786
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   787
+  if (tooltips->tip_window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   788
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   789
+      disconnect_tip_window_display_closed (tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   790
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   791
+      gtk_widget_destroy (tooltips->tip_window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   792
+      tooltips->tip_window = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   793
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   794
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   795
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   796
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   797
+trusted_tooltips_destroy (GtkObject *object)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   798
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   799
+  TrustedTooltips *tooltips = TRUSTED_TOOLTIPS (object);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   800
+  GList *current;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   801
+  TrustedTooltipsData *tooltipsdata;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   802
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   803
+  g_return_if_fail (tooltips != NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   804
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   805
+  if (tooltips->timer_tag)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   806
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   807
+      g_source_remove (tooltips->timer_tag);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   808
+      tooltips->timer_tag = 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   809
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   810
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   811
+  if (tooltips->tips_data_list != NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   812
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   813
+      current = g_list_first (tooltips->tips_data_list);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   814
+      while (current != NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   815
+	{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   816
+	  tooltipsdata = (TrustedTooltipsData*) current->data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   817
+	  current = current->next;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   818
+	  trusted_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   819
+	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   820
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   821
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   822
+  trusted_tooltips_unset_tip_window (tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   823
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   824
+  GTK_OBJECT_CLASS (parent_class)->destroy (object);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   825
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   826
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   827
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   828
+trusted_tooltips_update_screen (TrustedTooltips *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   829
+			    gboolean     new_window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   830
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   831
+  gboolean screen_changed = FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   832
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   833
+  if (tooltips->active_tips_data &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   834
+      tooltips->active_tips_data->widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   835
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   836
+      GdkScreen *screen = gtk_widget_get_screen (tooltips->active_tips_data->widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   837
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   838
+      screen_changed = (screen != gtk_widget_get_screen (tooltips->tip_window));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   839
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   840
+      if (screen_changed)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   841
+	{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   842
+	  if (!new_window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   843
+	    disconnect_tip_window_display_closed (tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   844
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   845
+	  gtk_window_set_screen (GTK_WINDOW (tooltips->tip_window), screen);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   846
+	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   847
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   848
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   849
+  if (screen_changed || new_window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   850
+    g_signal_connect (gtk_widget_get_display (tooltips->tip_window), "closed",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   851
+		      G_CALLBACK (tip_window_display_closed), tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   852
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   853
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   854
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   855
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   856
+trusted_tooltips_force_window (TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   857
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   858
+  g_return_if_fail (IS_TRUSTED_TOOLTIPS (tooltips));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   859
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   860
+  if (!tooltips->tip_window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   861
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   862
+      GtkWidget * vbox;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   863
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   864
+      tooltips->tip_window = gtk_window_new (GTK_WINDOW_POPUP);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   865
+      trusted_tooltips_update_screen (tooltips, TRUE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   866
+      gtk_widget_set_app_paintable (tooltips->tip_window, TRUE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   867
+      gtk_window_set_resizable (GTK_WINDOW (tooltips->tip_window), FALSE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   868
+      gtk_widget_set_name (tooltips->tip_window, "gtk-tooltips");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   869
+      gtk_container_set_border_width (GTK_CONTAINER (tooltips->tip_window), 2);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   870
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   871
+      g_signal_connect_swapped (tooltips->tip_window,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   872
+				"expose_event",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   873
+				G_CALLBACK (trusted_tooltips_paint_window), 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   874
+				tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   875
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   876
+      tooltips->tip_label = gtk_label_new (NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   877
+      gtk_label_set_line_wrap (GTK_LABEL (tooltips->tip_label), FALSE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   878
+      gtk_misc_set_alignment (GTK_MISC (tooltips->tip_label), 0.5, 0.5);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   879
+      gtk_widget_show (tooltips->tip_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   880
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   881
+      tooltips->tip_trusted_label = gtk_label_new (NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   882
+      gtk_label_set_line_wrap (GTK_LABEL (tooltips->tip_trusted_label), FALSE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   883
+      gtk_misc_set_alignment (GTK_MISC (tooltips->tip_trusted_label), 0.5, 0.5);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   884
+      gtk_widget_show (tooltips->tip_trusted_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   885
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   886
+      vbox = gtk_vbox_new (FALSE, 1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   887
+      tooltips->event = gtk_event_box_new ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   888
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   889
+      gtk_container_add (GTK_CONTAINER (tooltips->event), tooltips->tip_trusted_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   890
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   891
+      gtk_container_add (GTK_CONTAINER (vbox), tooltips->event);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   892
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   893
+      gtk_container_add (GTK_CONTAINER (vbox), tooltips->tip_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   894
+      gtk_container_add (GTK_CONTAINER (tooltips->tip_window), vbox);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   895
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   896
+      gtk_widget_show (vbox);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   897
+      gtk_widget_show (tooltips->event);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   898
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   899
+      g_signal_connect (tooltips->tip_window,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   900
+			"destroy",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   901
+			G_CALLBACK (gtk_widget_destroyed),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   902
+			&tooltips->tip_window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   903
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   904
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   905
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   906
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   907
+trusted_tooltips_enable (TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   908
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   909
+  g_return_if_fail (tooltips != NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   910
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   911
+  tooltips->enabled = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   912
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   913
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   914
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   915
+trusted_tooltips_disable (TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   916
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   917
+  g_return_if_fail (tooltips != NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   918
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   919
+  trusted_tooltips_set_active_widget (tooltips, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   920
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   921
+  tooltips->enabled = FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   922
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   923
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   924
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   925
+trusted_tooltips_set_delay (TrustedTooltips *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   926
+                        guint         delay)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   927
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   928
+  g_return_if_fail (tooltips != NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   929
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   930
+  tooltips->delay = delay;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   931
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   932
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   933
+TrustedTooltipsData*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   934
+trusted_tooltips_data_get (GtkWidget       *widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   935
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   936
+  g_return_val_if_fail (widget != NULL, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   937
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   938
+  return g_object_get_data (G_OBJECT (widget), tooltips_data_key);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   939
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   940
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   941
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   942
+trusted_tooltips_set_tip (TrustedTooltips *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   943
+		      GtkWidget   *widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   944
+		      const gchar *tip_text,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   945
+		      const gchar *trusted_label,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   946
+		      GdkColor	  *trusted_color,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   947
+		      const gchar *tip_private)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   948
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   949
+  TrustedTooltipsData *tooltipsdata;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   950
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   951
+  g_return_if_fail (IS_TRUSTED_TOOLTIPS (tooltips));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   952
+  g_return_if_fail (widget != NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   953
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   954
+  tooltipsdata = trusted_tooltips_data_get (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   955
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   956
+  if (!tip_text)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   957
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   958
+      if (tooltipsdata)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   959
+	trusted_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   960
+      return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   961
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   962
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   963
+  if (tooltips->active_tips_data 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   964
+      && tooltips->active_tips_data->widget == widget
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   965
+      && GTK_WIDGET_DRAWABLE (tooltips->active_tips_data->widget))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   966
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   967
+      g_free (tooltipsdata->tip_text);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   968
+      g_free (tooltipsdata->tip_private);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   969
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   970
+      tooltipsdata->tip_text = g_strdup (tip_text);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   971
+      tooltipsdata->tip_private = g_strdup (tip_private);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   972
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   973
+      trusted_tooltips_draw_tips (tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   974
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   975
+  else 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   976
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   977
+      g_object_ref (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   978
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   979
+      if (tooltipsdata)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   980
+        trusted_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   981
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   982
+      tooltipsdata = g_new0 (TrustedTooltipsData, 1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   983
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   984
+      tooltipsdata->tooltips = tooltips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   985
+      tooltipsdata->widget = widget;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   986
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   987
+      tooltipsdata->tip_text = g_strdup (tip_text);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   988
+      tooltipsdata->trusted_label = g_strdup (trusted_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   989
+      tooltipsdata->tip_private = g_strdup (tip_private);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   990
+      if (trusted_color)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   991
+	tooltipsdata->trusted_color = trusted_color;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   992
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   993
+      tooltips->tips_data_list = g_list_append (tooltips->tips_data_list,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   994
+                                                tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   995
+      g_signal_connect_after (widget, "event-after",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   996
+                              G_CALLBACK (trusted_tooltips_event_handler),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   997
+			      tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   998
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
   999
+      g_object_set_data (G_OBJECT (widget), tooltips_data_key,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1000
+                         tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1001
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1002
+      g_signal_connect (widget, "unmap",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1003
+			G_CALLBACK (trusted_tooltips_widget_unmap),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1004
+			tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1005
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1006
+      g_signal_connect (widget, "unrealize",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1007
+			G_CALLBACK (trusted_tooltips_widget_unmap),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1008
+			tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1009
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1010
+      g_signal_connect (widget, "destroy",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1011
+                        G_CALLBACK (trusted_tooltips_widget_remove),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1012
+			tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1013
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1014
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1015
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1016
+static gint
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1017
+trusted_tooltips_paint_window (TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1018
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1019
+  GtkRequisition req;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1020
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1021
+  gtk_widget_size_request (tooltips->tip_window, &req);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1022
+  gtk_paint_flat_box (tooltips->tip_window->style, tooltips->tip_window->window,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1023
+		      GTK_STATE_NORMAL, GTK_SHADOW_OUT, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1024
+		      NULL, GTK_WIDGET(tooltips->tip_window), "tooltip",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1025
+		      0, 0, req.width, req.height);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1026
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1027
+  return FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1028
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1029
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1030
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1031
+trusted_tooltips_draw_tips (TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1032
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1033
+  GtkRequisition requisition;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1034
+  GtkWidget *widget;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1035
+  GtkStyle *style;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1036
+  gint x, y, w, h;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1037
+  TrustedTooltipsData *data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1038
+  gboolean keyboard_mode;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1039
+  GdkScreen *screen;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1040
+  GdkScreen *pointer_screen;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1041
+  gint monitor_num, px, py;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1042
+  GdkRectangle monitor;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1043
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1044
+  if (!tooltips->tip_window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1045
+    trusted_tooltips_force_window (tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1046
+  else if (GTK_WIDGET_VISIBLE (tooltips->tip_window))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1047
+    g_get_current_time (&tooltips->last_popdown);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1048
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1049
+  gtk_widget_ensure_style (tooltips->tip_window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1050
+  style = tooltips->tip_window->style;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1051
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1052
+  widget = tooltips->active_tips_data->widget;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1053
+  g_object_set_data (G_OBJECT (tooltips->tip_window), tooltips_info_key,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1054
+                     tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1055
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1056
+  keyboard_mode = get_keyboard_mode (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1057
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1058
+  trusted_tooltips_update_screen (tooltips, FALSE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1059
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1060
+  screen = gtk_widget_get_screen (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1061
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1062
+  data = tooltips->active_tips_data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1063
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1064
+  if (tooltips->pager) /* pager special case */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1065
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1066
+      char *colorname;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1067
+      int error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1068
+      GdkColor label_color;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1069
+      m_label_t *mlabel = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1070
+      WnckWorkspace *tip_ws = g_object_get_data (G_OBJECT (tooltips->pager), 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1071
+						 "tip_ws");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1072
+						 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1073
+      const char *label = wnck_workspace_get_label (tip_ws);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1074
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1075
+      gtk_label_set_text (GTK_LABEL (tooltips->tip_label), 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1076
+			  wnck_workspace_get_name (tip_ws)); 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1077
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1078
+      if (_wnck_use_trusted_extensions ())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1079
+	{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1080
+	  if (label != NULL && 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1081
+	      (error = libtsol_str_to_label (label, &mlabel, MAC_LABEL, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1082
+				     L_NO_CORRECTION, &error)) == 0) 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1083
+	    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1084
+	      GdkPixbuf *pb;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1085
+	      guint32 rgba;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1086
+	      char *readable_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1087
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1088
+	      error = libtsol_label_to_str (mlabel, &colorname, M_COLOR, DEF_NAMES);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1089
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1090
+#define DEFAULT_COLOR	"white"	  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1091
+	      if (colorname == NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1092
+		colorname = g_strdup(DEFAULT_COLOR);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1093
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1094
+	      gdk_color_parse ((const char*)colorname, &label_color);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1095
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1096
+	      g_free (colorname);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1097
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1098
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1099
+	      readable_label = wnck_workspace_get_human_readable_label (tip_ws);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1100
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1101
+	      gtk_label_set_text (GTK_LABEL (tooltips->tip_trusted_label), readable_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1102
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1103
+	      g_free (readable_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1104
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1105
+	      gtk_widget_modify_bg (tooltips->event, GTK_STATE_NORMAL, &label_color);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1106
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1107
+	      gtk_widget_show (tooltips->event);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1108
+	    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1109
+	  else /* failed call to libtsol_label_to_str */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1110
+	    gtk_widget_hide (tooltips->event);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1111
+	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1112
+      else /* not using trusted_extensions */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1113
+	gtk_widget_hide (tooltips->event);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1114
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1115
+  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1116
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1117
+      gtk_label_set_text (GTK_LABEL (tooltips->tip_label), data->tip_text);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1118
+      gtk_label_set_text (GTK_LABEL (tooltips->tip_trusted_label), data->trusted_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1119
+      gtk_widget_modify_bg (tooltips->event, GTK_STATE_NORMAL, data->trusted_color);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1120
+      if (data->trusted_color == NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1121
+	gtk_widget_hide (tooltips->event);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1122
+      else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1123
+	gtk_widget_show (tooltips->event);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1124
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1125
+    
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1126
+ 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1127
+  gtk_widget_size_request (tooltips->tip_window, &requisition);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1128
+  w = requisition.width;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1129
+  h = requisition.height;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1130
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1131
+  gdk_window_get_origin (widget->window, &x, &y);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1132
+  if (GTK_WIDGET_NO_WINDOW (widget))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1133
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1134
+      x += widget->allocation.x;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1135
+      y += widget->allocation.y;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1136
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1137
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1138
+  x += widget->allocation.width / 2;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1139
+    
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1140
+  if (!keyboard_mode)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1141
+    gdk_window_get_pointer (gdk_screen_get_root_window (screen),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1142
+			    &x, NULL, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1143
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1144
+  x -= (w / 2 + 4);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1145
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1146
+  gdk_display_get_pointer (gdk_screen_get_display (screen),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1147
+			   &pointer_screen, &px, &py, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1148
+  if (pointer_screen != screen) 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1149
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1150
+      px = x;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1151
+      py = y;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1152
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1153
+  monitor_num = gdk_screen_get_monitor_at_point (screen, px, py);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1154
+  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1155
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1156
+  if ((x + w) > monitor.x + monitor.width)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1157
+    x -= (x + w) - (monitor.x + monitor.width);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1158
+  else if (x < monitor.x)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1159
+    x = monitor.x;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1160
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1161
+  if ((y + h + widget->allocation.height + 4) > monitor.y + monitor.height)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1162
+    y = y - h - 4;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1163
+  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1164
+    y = y + widget->allocation.height + 4;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1165
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1166
+  gtk_window_move (GTK_WINDOW (tooltips->tip_window), x, y);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1167
+  gtk_widget_show (tooltips->tip_window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1168
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1169
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1170
+static gint
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1171
+trusted_tooltips_timeout (gpointer data)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1172
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1173
+  TrustedTooltips *tooltips = (TrustedTooltips *) data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1174
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1175
+  GDK_THREADS_ENTER ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1176
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1177
+  if (tooltips->active_tips_data != NULL &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1178
+      GTK_WIDGET_DRAWABLE (tooltips->active_tips_data->widget))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1179
+    trusted_tooltips_draw_tips (tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1180
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1181
+  GDK_THREADS_LEAVE ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1182
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1183
+  return FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1184
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1185
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1186
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1187
+trusted_tooltips_set_active_widget (TrustedTooltips *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1188
+                                GtkWidget   *widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1189
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1190
+  if (tooltips->tip_window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1191
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1192
+      if (GTK_WIDGET_VISIBLE (tooltips->tip_window))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1193
+	g_get_current_time (&tooltips->last_popdown);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1194
+      gtk_widget_hide (tooltips->tip_window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1195
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1196
+  if (tooltips->timer_tag)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1197
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1198
+      g_source_remove (tooltips->timer_tag);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1199
+      tooltips->timer_tag = 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1200
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1201
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1202
+  tooltips->active_tips_data = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1203
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1204
+  if (widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1205
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1206
+      GList *list;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1207
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1208
+      for (list = tooltips->tips_data_list; list; list = list->next)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1209
+	{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1210
+	  TrustedTooltipsData *tooltipsdata;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1211
+	  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1212
+	  tooltipsdata = list->data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1213
+	  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1214
+	  if (tooltipsdata->widget == widget &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1215
+	      GTK_WIDGET_DRAWABLE (widget))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1216
+	    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1217
+	      tooltips->active_tips_data = tooltipsdata;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1218
+	      break;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1219
+	    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1220
+	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1221
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1222
+  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1223
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1224
+      tooltips->use_sticky_delay = FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1225
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1226
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1227
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1228
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1229
+trusted_tooltips_show_tip (GtkWidget *widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1230
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1231
+  TrustedTooltipsData *tooltipsdata;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1232
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1233
+  tooltipsdata = trusted_tooltips_data_get (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1234
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1235
+  if (tooltipsdata &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1236
+      (!tooltipsdata->tooltips->active_tips_data ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1237
+       tooltipsdata->tooltips->active_tips_data->widget != widget))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1238
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1239
+      trusted_tooltips_set_active_widget (tooltipsdata->tooltips, widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1240
+      trusted_tooltips_draw_tips (tooltipsdata->tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1241
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1242
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1243
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1244
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1245
+trusted_tooltips_hide_tip (GtkWidget *widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1246
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1247
+  TrustedTooltipsData *tooltipsdata;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1248
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1249
+  tooltipsdata = trusted_tooltips_data_get (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1250
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1251
+  if (tooltipsdata &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1252
+      (tooltipsdata->tooltips->active_tips_data &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1253
+       tooltipsdata->tooltips->active_tips_data->widget == widget))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1254
+    trusted_tooltips_set_active_widget (tooltipsdata->tooltips, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1255
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1256
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1257
+static gboolean
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1258
+trusted_tooltips_recently_shown (TrustedTooltips *tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1259
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1260
+  GTimeVal now;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1261
+  glong msec;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1262
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1263
+  g_get_current_time (&now);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1264
+  msec = (now.tv_sec  - tooltips->last_popdown.tv_sec) * 1000 +
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1265
+	  (now.tv_usec - tooltips->last_popdown.tv_usec) / 1000;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1266
+  return (msec < STICKY_REVERT_DELAY);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1267
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1268
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1269
+static gboolean
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1270
+get_keyboard_mode (GtkWidget *widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1271
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1272
+  GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1273
+  if (GTK_IS_WINDOW (toplevel))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1274
+    return GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (toplevel), "gtk-tooltips-keyboard-mode"));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1275
+  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1276
+    return FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1277
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1278
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1279
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1280
+start_keyboard_mode (GtkWidget *widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1281
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1282
+  GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1283
+  if (GTK_IS_WINDOW (toplevel))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1284
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1285
+      GtkWidget *focus = GTK_WINDOW (toplevel)->focus_widget;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1286
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1287
+      g_object_set_data (G_OBJECT (toplevel), "gtk-tooltips-keyboard-mode", GUINT_TO_POINTER (TRUE));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1288
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1289
+      if (focus)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1290
+	trusted_tooltips_show_tip (focus);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1291
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1292
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1293
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1294
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1295
+stop_keyboard_mode (GtkWidget *widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1296
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1297
+  GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1298
+  if (GTK_IS_WINDOW (toplevel))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1299
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1300
+      GtkWidget *focus = GTK_WINDOW (toplevel)->focus_widget;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1301
+      if (focus)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1302
+	trusted_tooltips_hide_tip (focus);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1303
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1304
+      g_object_set_data (G_OBJECT (toplevel), "gtk-tooltips-keyboard-mode", GUINT_TO_POINTER (FALSE));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1305
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1306
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1307
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1308
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1309
+trusted_tooltips_start_delay (TrustedTooltips *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1310
+			  GtkWidget   *widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1311
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1312
+  TrustedTooltipsData *old_tips_data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1313
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1314
+  old_tips_data = tooltips->active_tips_data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1315
+  if (tooltips->enabled &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1316
+      (!old_tips_data || old_tips_data->widget != widget))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1317
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1318
+      guint delay;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1319
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1320
+      trusted_tooltips_set_active_widget (tooltips, widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1321
+      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1322
+      if (tooltips->use_sticky_delay &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1323
+	  trusted_tooltips_recently_shown (tooltips))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1324
+	delay = STICKY_DELAY;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1325
+      else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1326
+	delay = tooltips->delay;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1327
+      tooltips->timer_tag = g_timeout_add (delay,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1328
+					   trusted_tooltips_timeout,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1329
+					   (gpointer) tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1330
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1331
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1332
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1333
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1334
+trusted_tooltips_event_handler (GtkWidget *widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1335
+                            GdkEvent  *event)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1336
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1337
+  TrustedTooltips *tooltips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1338
+  TrustedTooltipsData *old_tips_data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1339
+  GtkWidget *event_widget;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1340
+  gboolean keyboard_mode = get_keyboard_mode (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1341
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1342
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1343
+  if ((event->type == GDK_LEAVE_NOTIFY || event->type == GDK_ENTER_NOTIFY) &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1344
+      event->crossing.detail == GDK_NOTIFY_INFERIOR)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1345
+    return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1346
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1347
+  old_tips_data = trusted_tooltips_data_get (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1348
+  tooltips = old_tips_data->tooltips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1349
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1350
+  if (keyboard_mode)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1351
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1352
+      switch (event->type)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1353
+	{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1354
+	case GDK_FOCUS_CHANGE:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1355
+	  if (event->focus_change.in)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1356
+	    trusted_tooltips_show_tip (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1357
+	  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1358
+	    trusted_tooltips_hide_tip (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1359
+	  break;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1360
+	default:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1361
+	  break;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1362
+	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1363
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1364
+  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1365
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1366
+      if (event->type != GDK_KEY_PRESS && event->type != GDK_KEY_RELEASE)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1367
+	{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1368
+	  event_widget = gtk_get_event_widget (event);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1369
+	  if (event_widget != widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1370
+	    return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1371
+	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1372
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1373
+      if (tooltips->pager != NULL) /* handler pager tooltips special case */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1374
+	{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1375
+	  static WnckWorkspace *current = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1376
+	  if (event->type == GDK_MOTION_NOTIFY || event->type == GDK_ENTER_NOTIFY)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1377
+	    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1378
+	      WnckWorkspace *tip_ws = g_object_get_data (G_OBJECT (tooltips->pager), 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1379
+							 "tip_ws");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1380
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1381
+	      if (current != tip_ws) 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1382
+		{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1383
+		  /* do something only if the workspace changed */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1384
+		  current = tip_ws;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1385
+		  trusted_tooltips_set_active_widget (tooltips, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1386
+		  trusted_tooltips_start_delay (tooltips, widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1387
+		}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1388
+	    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1389
+	  if (event->type == GDK_LEAVE_NOTIFY)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1390
+	    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1391
+	      trusted_tooltips_set_active_widget (tooltips, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1392
+	      current = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1393
+	    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1394
+	} 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1395
+      else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1396
+	{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1397
+	  switch (event->type)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1398
+	    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1399
+	    case GDK_EXPOSE:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1400
+	      /* do nothing */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1401
+	      break;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1402
+	    case GDK_ENTER_NOTIFY:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1403
+	      if (!(GTK_IS_MENU_ITEM (widget) && GTK_MENU_ITEM (widget)->submenu))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1404
+		trusted_tooltips_start_delay (tooltips, widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1405
+	      break;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1406
+	      
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1407
+	    case GDK_LEAVE_NOTIFY:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1408
+	      {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1409
+		gboolean use_sticky_delay;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1410
+		
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1411
+		use_sticky_delay = tooltips->tip_window &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1412
+		  GTK_WIDGET_VISIBLE (tooltips->tip_window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1413
+		trusted_tooltips_set_active_widget (tooltips, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1414
+		tooltips->use_sticky_delay = use_sticky_delay;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1415
+	      }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1416
+	      break;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1417
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1418
+	    case GDK_MOTION_NOTIFY:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1419
+	      /* Handle menu items specially ... pend popup for each motion
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1420
+	       * on other widgets, we ignore motion.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1421
+	       */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1422
+	      if (GTK_IS_MENU_ITEM (widget) && !GTK_MENU_ITEM (widget)->submenu)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1423
+		{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1424
+		  /* Completely evil hack to make sure we get the LEAVE_NOTIFY
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1425
+		   */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1426
+		  /* GTK_PRIVATE_SET_FLAG (widget, GTK_LEAVE_PENDING); */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1427
+		  trusted_tooltips_set_active_widget (tooltips, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1428
+		  trusted_tooltips_start_delay (tooltips, widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1429
+		  break;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1430
+		}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1431
+	      break;		/* ignore */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1432
+	    case GDK_BUTTON_PRESS:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1433
+	    case GDK_BUTTON_RELEASE:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1434
+	    case GDK_KEY_PRESS:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1435
+	    case GDK_KEY_RELEASE:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1436
+	    case GDK_PROXIMITY_IN:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1437
+	    case GDK_SCROLL:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1438
+	      trusted_tooltips_set_active_widget (tooltips, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1439
+	      break;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1440
+	    default:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1441
+	      break;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1442
+	    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1443
+	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1444
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1445
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1446
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1447
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1448
+trusted_tooltips_widget_unmap (GtkWidget *widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1449
+			   gpointer   data)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1450
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1451
+  TrustedTooltipsData *tooltipsdata = (TrustedTooltipsData *)data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1452
+  TrustedTooltips *tooltips = tooltipsdata->tooltips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1453
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1454
+  if (tooltips->active_tips_data &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1455
+      (tooltips->active_tips_data->widget == widget))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1456
+    trusted_tooltips_set_active_widget (tooltips, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1457
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1458
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1459
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1460
+trusted_tooltips_widget_remove (GtkWidget *widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1461
+			    gpointer   data)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1462
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1463
+  TrustedTooltipsData *tooltipsdata = (TrustedTooltipsData*) data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1464
+  TrustedTooltips *tooltips = tooltipsdata->tooltips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1465
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1466
+  trusted_tooltips_widget_unmap (widget, data);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1467
+  tooltips->tips_data_list = g_list_remove (tooltips->tips_data_list,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1468
+					    tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1469
+  trusted_tooltips_destroy_data (tooltipsdata);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1470
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1471
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1472
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1473
+_trusted_tooltips_toggle_keyboard_mode (GtkWidget *widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1474
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1475
+  if (get_keyboard_mode (widget))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1476
+    stop_keyboard_mode (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1477
+  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1478
+    start_keyboard_mode (widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1479
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1480
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1481
+/**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1482
+ * trusted_tooltips_get_info_from_tip_window:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1483
+ * @tip_window: a #GtkWindow 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1484
+ * @tooltips: the return location for the tooltips which are displayed 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1485
+ *    in @tip_window, or %NULL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1486
+ * @current_widget: the return location for the widget whose tooltips 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1487
+ *    are displayed, or %NULL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1488
+ * 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1489
+ * Determines the tooltips and the widget they belong to from the window in 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1490
+ * which they are displayed. 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1491
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1492
+ * This function is mostly intended for use by accessibility technologies;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1493
+ * applications should have little use for it.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1494
+ * 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1495
+ * Return value: %TRUE if @tip_window is displaying tooltips, otherwise %FALSE.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1496
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1497
+ * Since: 2.4
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1498
+ **/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1499
+gboolean
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1500
+trusted_tooltips_get_info_from_tip_window (GtkWindow    *tip_window,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1501
+                                       TrustedTooltips **tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1502
+                                       GtkWidget   **current_widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1503
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1504
+  TrustedTooltips  *current_tooltips;  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1505
+  gboolean has_tips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1506
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1507
+  g_return_val_if_fail (GTK_IS_WINDOW (tip_window), FALSE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1508
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1509
+  current_tooltips = g_object_get_data (G_OBJECT (tip_window), tooltips_info_key);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1510
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1511
+  has_tips = current_tooltips != NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1512
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1513
+  if (tooltips)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1514
+    *tooltips = current_tooltips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1515
+  if (current_widget)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1516
+    *current_widget = has_tips ? current_tooltips->active_tips_data->widget : NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1517
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1518
+  return has_tips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1519
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1520
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1521
+trusted_tooltips_set_pager (TrustedTooltips *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1522
+			    WnckPager *pager)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1523
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1524
+   tooltips->pager = pager;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1525
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1526
+#endif /* HAVE_XTSOL */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1527
+#define __TRUSTED_TOOLTIPS_C__
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1528
diff -urN libwnck.orig/libwnck/trusted-tooltips.h libwnck.new/libwnck/trusted-tooltips.h
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1529
--- libwnck.orig/libwnck/trusted-tooltips.h	1970-01-01 01:00:00.000000000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1530
+++ libwnck.new/libwnck/trusted-tooltips.h	2008-08-06 23:43:40.108722000 +0100
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1531
@@ -0,0 +1,120 @@
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1532
+/* GTK - The GIMP Toolkit
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1533
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1534
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1535
+ * This library is free software; you can redistribute it and/or
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1536
+ * modify it under the terms of the GNU Lesser General Public
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1537
+ * License as published by the Free Software Foundation; either
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1538
+ * version 2 of the License, or (at your option) any later version.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1539
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1540
+ * This library is distributed in the hope that it will be useful,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1541
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1542
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1543
+ * Lesser General Public License for more details.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1544
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1545
+ * You should have received a copy of the GNU Lesser General Public
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1546
+ * License along with this library; if not, write to the
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1547
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1548
+ * Boston, MA 02111-1307, USA.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1549
+ */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1550
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1551
+/*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1552
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1553
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1554
+ * files for a list of changes.  These files are distributed with
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1555
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1556
+ */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1557
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1558
+#ifndef __TRUSTED_TOOLTIPS_H__
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1559
+#define __TRUSTED_TOOLTIPS_H__
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1560
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1561
+#include <gtk/gtkwidget.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1562
+#include <gtk/gtkwindow.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1563
+#include "pager.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1564
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1565
+G_BEGIN_DECLS
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1566
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1567
+#define TRUSTED_TOOLTIPS_TYPE                  (trusted_tooltips_get_type ())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1568
+#define TRUSTED_TOOLTIPS(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRUSTED_TOOLTIPS_TYPE, TrustedTooltips))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1569
+#define TRUSTED_TOOLTIPS_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), TRUSTED_TOOLTIPS_TYPE, TrustedTooltipsClass))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1570
+#define IS_TRUSTED_TOOLTIPS(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRUSTED_TOOLTIPS_TYPE))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1571
+#define IS_TRUSTED_TOOLTIPS_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), TRUSTED_TOOLTIPS_TYPE))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1572
+#define TRUSTED_TOOLTIPS_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), TRUSTED_TOOLTIPS_TYPE, TrustedTooltipsClass))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1573
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1574
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1575
+typedef struct _TrustedTooltips	 TrustedTooltips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1576
+typedef struct _TrustedTooltipsClass TrustedTooltipsClass;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1577
+typedef struct _TrustedTooltipsData	 TrustedTooltipsData;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1578
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1579
+struct _TrustedTooltipsData
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1580
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1581
+  TrustedTooltips *tooltips;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1582
+  GtkWidget *widget;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1583
+  gchar *tip_text;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1584
+  gchar *trusted_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1585
+  GdkColor  *trusted_color;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1586
+  gchar *tip_private;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1587
+};
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1588
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1589
+struct _TrustedTooltips
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1590
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1591
+  GtkObject parent_instance;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1592
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1593
+  GtkWidget *tip_window;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1594
+  GtkWidget *tip_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1595
+  GtkWidget *tip_trusted_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1596
+  GtkWidget *event;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1597
+  TrustedTooltipsData *active_tips_data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1598
+  GList *tips_data_list;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1599
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1600
+  guint   delay : 30;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1601
+  guint	  enabled : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1602
+  guint   have_grab : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1603
+  guint   use_sticky_delay : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1604
+  gint	  timer_tag;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1605
+  GTimeVal last_popdown;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1606
+  WnckPager *pager;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1607
+};
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1608
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1609
+struct _TrustedTooltipsClass
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1610
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1611
+  GtkObjectClass parent_class;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1612
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1613
+  /* Padding for future expansion */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1614
+  void (*_gtk_reserved1) (void);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1615
+  void (*_gtk_reserved2) (void);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1616
+  void (*_gtk_reserved3) (void);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1617
+  void (*_gtk_reserved4) (void);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1618
+};
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1619
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1620
+GType		 trusted_tooltips_get_type	   (void) G_GNUC_CONST;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1621
+TrustedTooltips*	 trusted_tooltips_new	   (void);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1622
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1623
+void		 trusted_tooltips_enable	   (TrustedTooltips   *tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1624
+void		 trusted_tooltips_disable	   (TrustedTooltips   *tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1625
+#ifndef GTK_DISABLE_DEPRECATED
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1626
+void		 trusted_tooltips_set_delay	   (TrustedTooltips   *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1627
+					    guint	   delay);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1628
+#endif /* GTK_DISABLE_DEPRECATED */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1629
+void		 trusted_tooltips_set_tip	   (TrustedTooltips   *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1630
+						    GtkWidget	  *widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1631
+						    const gchar   *tip_text,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1632
+						    const gchar   *trusted_label,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1633
+						    GdkColor	  *trusted_color,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1634
+						    const gchar   *tip_private);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1635
+TrustedTooltipsData* trusted_tooltips_data_get	   (GtkWidget	  *widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1636
+void             trusted_tooltips_force_window (TrustedTooltips   *tooltips);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1637
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1638
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1639
+void             _trusted_tooltips_toggle_keyboard_mode (GtkWidget *widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1640
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1641
+gboolean         trusted_tooltips_get_info_from_tip_window (GtkWindow    *tip_window,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1642
+                                                        TrustedTooltips **tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1643
+                                                        GtkWidget   **current_widget);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1644
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1645
+void		 trusted_tooltips_set_pager	  (TrustedTooltips *tooltips,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1646
+						   WnckPager *pager);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1647
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1648
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1649
+G_END_DECLS
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1650
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1651
+#endif /* __TRUSTED_TOOLTIPS_H__ */
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1652
diff -urN libwnck.orig/libwnck/tsol-pics.h libwnck.new/libwnck/tsol-pics.h
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1653
--- libwnck.orig/libwnck/tsol-pics.h	1970-01-01 01:00:00.000000000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1654
+++ libwnck.new/libwnck/tsol-pics.h	2008-08-06 23:43:40.110678000 +0100
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1655
@@ -0,0 +1,43 @@
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1656
+/* GdkPixbuf RGBA C-Source image dump */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1657
+ 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1658
+#ifdef __SUNPRO_C
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1659
+#pragma align 4 (highlight_stripe_pb)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1660
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1661
+#ifdef __GNUC__
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1662
+static const guint8 highlight_stripe_pb[] __attribute__ ((__aligned__ (4))) =
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1663
+#else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1664
+static const guint8 highlight_stripe_pb[] =
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1665
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1666
+{ ""
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1667
+  /* Pixbuf magic (0x47646b50) */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1668
+  "GdkP"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1669
+  /* length: header (24) + pixel_data (704) */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1670
+  "\0\0\2\330"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1671
+  /* pixdata_type (0x1010002) */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1672
+  "\1\1\0\2"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1673
+  /* rowstride (176) */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1674
+  "\0\0\0\260"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1675
+  /* width (44) */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1676
+  "\0\0\0,"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1677
+  /* height (4) */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1678
+  "\0\0\0\4"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1679
+  /* pixel_data: */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1680
+  "\0\0\0\0^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1681
+  "^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1682
+  "^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1683
+  "^^^\377^^^\377^^^\377^^^\377^^^\365^^^\336^^^\303^^^\246^^^\207^^^[^"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1684
+  "^^3^^^\26^^^\5^^^\2^^^\360^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1685
+  "^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1686
+  "^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1687
+  "^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\365^^^\336^^^\303"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1688
+  "^^^\246^^^\207^^^[^^^3^^^\26^^^\5^^^\2^^^\360^^^\377^^^\377^^^\377^^"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1689
+  "^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1690
+  "^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1691
+  "^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1692
+  "^^^\365^^^\336^^^\303^^^\246^^^\207^^^[^^^3^^^\26^^^\5^^^\2\0\0\0\0^"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1693
+  "^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1694
+  "^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1695
+  "^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377^^^\377"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1696
+  "^^^\377^^^\377^^^\377^^^\365^^^\336^^^\303^^^\246^^^\207^^^[^^^3^^^\26"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1697
+  "^^^\5^^^\2"};
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1698
+
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1699
diff -urN libwnck.orig/libwnck/window.c libwnck.new/libwnck/window.c
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1700
--- libwnck.orig/libwnck/window.c	2008-08-06 23:43:13.689319000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1701
+++ libwnck.new/libwnck/window.c	2008-08-06 23:43:40.130350000 +0100
11201
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
  1702
@@ -47,6 +47,13 @@
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1703
  * referenced or unreferenced.
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1704
  */
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1705
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1706
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1707
+#include <strings.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1708
+#include <sys/types.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1709
+#include <unistd.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1710
+#include <wnck-tsol.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1711
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1712
+
9988
a349549365dc 2007-06-05 Damien Carbery <[email protected]>
dcarbery
parents: 9890
diff changeset
  1713
 #define FALLBACK_NAME _("Untitled window")
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1714
 #define ALL_WORKSPACES (0xFFFFFFFF)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1715
 
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1716
@@ -83,6 +90,12 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1717
   char *icon_name;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1718
   char *session_id;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1719
   char *session_id_utf8;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1720
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1721
+  char *label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1722
+  GdkColor *label_color;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1723
+  char *label_color_str;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1724
+  char *role;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1725
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1726
   int pid;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1727
   int workspace;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1728
   gint sort_order;
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1729
@@ -100,6 +113,9 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1730
   int y;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1731
   int width;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1732
   int height;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1733
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1734
+  int is_trusted;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1735
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1736
 
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1737
   int left_frame;
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1738
   int right_frame;
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1739
@@ -161,6 +177,9 @@
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  1740
 
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  1741
   guint need_emit_name_changed : 1;
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  1742
   guint need_emit_icon_changed : 1;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1743
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1744
+  guint need_update_label : 1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1745
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1746
 };
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1747
 
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1748
 G_DEFINE_TYPE (WnckWindow, wnck_window, G_TYPE_OBJECT);
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1749
@@ -223,6 +242,9 @@
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1750
   window->priv->group_leader = None;
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1751
   window->priv->transient_for = None;
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  1752
   window->priv->icon_geometry.width = -1; /* invalid cached value */
8584
75c0fd12d8d8 2006-11-16 Niall Power <[email protected]>
niall
parents: 8535
diff changeset
  1753
+#ifdef HAVE_XTSOL
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1754
+  window->priv->is_trusted = -1;
8584
75c0fd12d8d8 2006-11-16 Niall Power <[email protected]>
niall
parents: 8535
diff changeset
  1755
+#endif
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1756
   window->priv->name = NULL;
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1757
   window->priv->icon_name = NULL;
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1758
   window->priv->session_id = NULL;
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1759
@@ -446,6 +468,12 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1760
   _wnck_icon_cache_free (window->priv->icon_cache);
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1761
   window->priv->icon_cache = NULL;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1762
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1763
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1764
+  g_free (window->priv->label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1765
+  g_free (window->priv->label_color);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1766
+  g_free (window->priv->role);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1767
+#endif
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1768
+
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1769
   g_free (window->priv->startup_id);
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1770
   window->priv->startup_id = NULL;
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1771
   g_free (window->priv->res_class);
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1772
@@ -559,11 +587,40 @@
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1773
   window->priv->need_update_frame_extents = TRUE;
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  1774
   window->priv->need_emit_name_changed = FALSE;
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  1775
   window->priv->need_emit_icon_changed = FALSE;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1776
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1777
+  window->priv->need_update_label = TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1778
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1779
   force_update_now (window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1780
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1781
   return window;
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1782
 }
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1783
 
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1784
+#ifdef HAVE_XTSOL
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1785
+/**
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1786
+ * wnck_window_is_trusted:
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1787
+ * @window: a #WnckWindow
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1788
+ *
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1789
+ * Trusted here means that the application running in the window is
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1790
+ * in the trusted path.
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1791
+ *
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1792
+ * Return value: %TRUE if the window is trusted.
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1793
+ **/
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1794
+gboolean
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1795
+wnck_window_is_trusted                (WnckWindow *window)
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1796
+{
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1797
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE);
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1798
+  if (!_wnck_check_xtsol_extension()) {
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1799
+      g_warning ("wnck_window_is_trusted() was called but the X server does not support the SUN_TSOL extension");
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1800
+      return 0;
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1801
+  }
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1802
+  if (!_wnck_use_trusted_extensions()) {
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1803
+      g_warning ("wnck_window_is_trusted(): Can not initialise the trusted extensions libraries. Check your installation");
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1804
+      return 0;
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1805
+  }
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1806
+  return window->priv->is_trusted;
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1807
+}
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1808
+#endif
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1809
+
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1810
 void
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1811
 _wnck_window_destroy (WnckWindow *window)
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1812
 {
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1813
@@ -711,6 +768,92 @@
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1814
     return g_strdup (name);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1815
 }
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1816
 
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1817
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1818
+/**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1819
+ * wnck_window_get_label:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1820
+ * @window: a #WnckWindow
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1821
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1822
+ * Gets the sensitivity label of the window in it's long string
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1823
+ * representation.
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1824
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1825
+ * Return value: sensitivity label of the window.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1826
+ * If the window has no sensitivity label set, %NULL is returned.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1827
+ **/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1828
+const char*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1829
+wnck_window_get_label (WnckWindow *window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1830
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1831
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1832
+  if (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1833
+      return window->priv->label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1834
+  return NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1835
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1836
+/**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1837
+ * wnck_window_get_label_human_readable:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1838
+ * @window: a #WnckWindow
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1839
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1840
+ * Gets the sensitivity label of the window and returns it in a
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1841
+ * form suitable for presentation in a user visible interface.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1842
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1843
+ * Return value: sensitivity label of the window appropriate for
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1844
+ * human presentation.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1845
+ * If the window has no sensitivity label set, %NULL is returned.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1846
+ **/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1847
+char*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1848
+wnck_window_get_label_human_readable (WnckWindow *window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1849
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1850
+  char *human_readable_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1851
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1852
+  if (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1853
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1854
+      int error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1855
+      m_label_t *mlabel = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1856
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1857
+      if (wnck_window_is_trusted (window))
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1858
+       /* SUN_BRANDING TJDS */
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1859
+       return g_strdup (_("Trusted Path"));
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1860
+
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1861
+      if (window->priv->label != NULL &&
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1862
+         (error = libtsol_str_to_label (window->priv->label,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1863
+                                &mlabel, MAC_LABEL,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1864
+                                L_NO_CORRECTION, &error)) == 0)
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1865
+       {
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1866
+         error = libtsol_label_to_str (mlabel,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1867
+                               &human_readable_label,
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1868
+                               M_LABEL, DEF_NAMES);
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1869
+         return human_readable_label;
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  1870
+       }
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1871
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1872
+  return NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1873
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1874
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1875
+GdkColor *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1876
+wnck_window_get_label_color (WnckWindow *window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1877
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1878
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1879
+  if (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1880
+      return window->priv->label_color;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1881
+  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1882
+      return NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1883
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1884
+
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  1885
+const char *
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1886
+wnck_window_get_label_color_str (WnckWindow *window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1887
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1888
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1889
+  if (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1890
+      return window->priv->label_color_str;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1891
+  else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1892
+      return NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1893
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1894
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1895
+const char *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1896
+wnck_window_get_role (WnckWindow *window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1897
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1898
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1899
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1900
+  return window->priv->role;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1901
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1902
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1903
 
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1904
 /**
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  1905
  * wnck_window_get_application:
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1906
@@ -1777,9 +1920,44 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1907
 wnck_window_move_to_workspace (WnckWindow    *window,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1908
                                WnckWorkspace *space)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1909
 {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1910
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1911
+  static char *workstationowner = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1912
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1913
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1914
   g_return_if_fail (WNCK_IS_WINDOW (window));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1915
   g_return_if_fail (WNCK_IS_WORKSPACE (space));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1916
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1917
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1918
+  if ((_wnck_check_xtsol_extension) && (_wnck_use_trusted_extensions ())) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1919
+    char *windowrole = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1920
+    char *workspacerole = wnck_workspace_get_role (space);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1921
+	windowrole = wnck_window_get_role (window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1922
+    /*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1923
+     * Only windows that are in the Trusted Path
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1924
+     * are allowed to be move onto a role workspace
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1925
+     * This could be implemented in _wnck_window_change_workspace() but
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1926
+     * it's less complicated to do so here.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1927
+     */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1928
+    if (workstationowner == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1929
+      uid_t wsuid;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1930
+      struct passwd *pwd;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1931
+      if ((libxtsol_XTSOLgetWorkstationOwner (gdk_x11_get_default_xdisplay (), &wsuid)) < 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1932
+        g_warning ("XTSOLgetWorkstationOwner() failed. Using getuid() instead");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1933
+        pwd = getpwuid (getuid ());
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1934
+      } else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1935
+        pwd = getpwuid (wsuid);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1936
+	  workstationowner = g_strdup (pwd->pw_name);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1937
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1938
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1939
+    /* Don't allow non-trusted path windows into role workspaces unless the window role
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1940
+     * matches the workspace role
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1941
+     */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1942
+    if ((workspacerole != NULL) && (strcmp (workstationowner, workspacerole)) &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1943
+      (!wnck_window_is_trusted (window)) && (strcmp (workspacerole, windowrole)))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1944
+      return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1945
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1946
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1947
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1948
   _wnck_change_workspace (WNCK_SCREEN_XSCREEN (window->priv->screen),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1949
 			  window->priv->xwindow,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1950
                           wnck_workspace_get_number (space));
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1951
@@ -2387,9 +2565,38 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1952
 wnck_window_is_on_workspace (WnckWindow    *window,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1953
                              WnckWorkspace *workspace)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1954
 {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1955
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1956
+  static char *workstationowner = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1957
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1958
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1959
   g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1960
   g_return_val_if_fail (WNCK_IS_WORKSPACE (workspace), FALSE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1961
   
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1962
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1963
+  /*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1964
+   * Non trusted path windows will not be visible on role workspaces
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1965
+   * unless the window role matches the workspace role.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1966
+   */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1967
+  if (_wnck_use_trusted_extensions () && _wnck_check_xtsol_extension ()) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1968
+	char *windowrole = g_strdup (wnck_window_get_role (window));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1969
+    char *workspacerole = wnck_workspace_get_role (workspace);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1970
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1971
+    if (workstationowner == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1972
+      uid_t wsuid;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1973
+      struct passwd *pwd;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1974
+      if ((libxtsol_XTSOLgetWorkstationOwner (gdk_x11_get_default_xdisplay (), &wsuid)) < 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1975
+        g_warning ("XTSOLgetWorkstationOwner() failed. Using getuid() instead");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1976
+        pwd = getpwuid (getuid ());
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1977
+      } else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1978
+        pwd = getpwuid (wsuid);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1979
+	  workstationowner = g_strdup (pwd->pw_name);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1980
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1981
+    if ((workspacerole != NULL) && (strcmp (workstationowner, workspacerole)) &&
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1982
+      (!wnck_window_is_trusted (window)) && (strcmp (workspacerole, windowrole))) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1983
+      return FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1984
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1985
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1986
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1987
   return wnck_window_is_pinned (window) ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1988
     wnck_window_get_workspace (window) == workspace;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1989
 }
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  1990
@@ -2416,8 +2623,12 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1991
   g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1992
   g_return_val_if_fail (WNCK_IS_WORKSPACE (workspace), FALSE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1993
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1994
+  /* Being pinned is no guarantee in a trusted desktop */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1995
+  /* TESTME */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1996
+#ifndef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1997
   if (wnck_window_is_pinned (window) )
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1998
     return TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  1999
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2000
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2001
   if (wnck_window_get_workspace (window) != workspace)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2002
     return FALSE;
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2003
@@ -2792,6 +3003,91 @@
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  2004
   window->priv->icon_name = new_name;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2005
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2006
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2007
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2008
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2009
+static void 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2010
+update_label_color (WnckWindow *window, m_label_t* label)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2011
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2012
+  #define DEFAULT_COLOR	"white"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2013
+  int error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2014
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2015
+  if (window->priv->label_color)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2016
+    g_free (window->priv->label_color);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2017
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2018
+  if (window->priv->label_color_str)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2019
+    g_free (window->priv->label_color_str);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2020
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2021
+  window->priv->label_color = g_new0 (GdkColor, 1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2022
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2023
+  error = libtsol_label_to_str (label, &window->priv->label_color_str, M_COLOR, DEF_NAMES);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2024
+  if (window->priv->label_color_str == NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2025
+    window->priv->label_color_str = g_strdup(DEFAULT_COLOR);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2026
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2027
+  gdk_color_parse ((const char*)window->priv->label_color_str, window->priv->label_color);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2028
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2029
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2030
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2031
+update_window_role (WnckWindow *window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2032
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2033
+  int error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2034
+  gulong xid;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2035
+  uid_t uid = -1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2036
+  struct passwd *pwd;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2037
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2038
+  if (window->priv->role)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2039
+    g_free (window->priv->role);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2040
+  xid = wnck_window_get_xid (window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2041
+  error = libxtsol_XTSOLgetResUID (gdk_x11_get_default_xdisplay (),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2042
+    xid, IsWindow, &uid);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2043
+  if ((error < 0) || (uid < 0)) {
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  2044
+    pwd = getpwuid (getuid);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2045
+    g_warning ("XTSOLgetResUID() failed. Assuming window %d belongs to %s\n", xid, pwd->pw_name);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2046
+  } else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2047
+    pwd = getpwuid (uid);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2048
+  window->priv->role = g_strdup (pwd->pw_name);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2049
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2050
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2051
+/*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2052
+ * Since window sensitivity labels are static, this is a one time
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2053
+ * only function for each window.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2054
+ */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2055
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2056
+wnck_window_update_label (WnckWindow *window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2057
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2058
+  g_return_if_fail (window->priv->label == NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2059
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2060
+  if (!window->priv->need_update_label)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2061
+    return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2062
+  window->priv->need_update_label = FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2063
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2064
+  if (!_wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2065
+    return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2066
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2067
+  /* Check for a trusted windowing environment first */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2068
+  if (_wnck_check_xtsol_extension () && _wnck_use_trusted_extensions()) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2069
+      if (window->priv->label == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2070
+          m_label_t label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2071
+          int error;
15579
d26c3d31b0bd 2009-04-07 Stephen Browne <[email protected]>
stephen
parents: 14986
diff changeset
  2072
+          if (libxtsol_XTSOLgetResLabel(gdk_display, window->priv->xwindow,
d26c3d31b0bd 2009-04-07 Stephen Browne <[email protected]>
stephen
parents: 14986
diff changeset
  2073
+                                          IsWindow, &label)) {
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2074
+             error = libtsol_label_to_str (&label, &window->priv->label, M_INTERNAL,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2075
+                                   LONG_NAMES);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2076
+	      /* add label color */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2077
+	     update_label_color (window, &label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2078
+	     update_window_role (window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2079
+	     
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2080
+          } else {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2081
+             window->priv->label = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2082
+          }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2083
+      }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2084
+  } else {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2085
+      g_warning("Window labelling needs the SUN_TSOL X server extension");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2086
+      return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2087
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2088
+ 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2089
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2090
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2091
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2092
 static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2093
 update_workspace (WnckWindow *window)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2094
 {
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2095
@@ -3149,6 +3445,14 @@
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  2096
   if (window->priv->need_emit_name_changed)
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2097
     emit_name_changed (window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2098
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2099
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2100
+  if (_wnck_check_xtsol_extension () && _wnck_use_trusted_extensions()) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2101
+      if (window->priv->is_trusted < 0)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2102
+          window->priv->is_trusted = libxtsol_XTSOLIsWindowTrusted (gdk_display, window->priv->xwindow);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2103
+      if (window->priv->label == NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2104
+          wnck_window_update_label (window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2105
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2106
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2107
   old_state = COMPRESS_STATE (window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2108
   old_actions = window->priv->actions;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2109
 
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2110
diff -urN libwnck.orig/libwnck/window.h libwnck.new/libwnck/window.h
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2111
--- libwnck.orig/libwnck/window.h	2008-08-06 23:43:13.423557000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2112
+++ libwnck.new/libwnck/window.h	2008-08-06 23:43:40.134710000 +0100
11201
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
  2113
@@ -31,6 +31,7 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2114
 #include <glib-object.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2115
 #include <libwnck/screen.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2116
 #include <gdk-pixbuf/gdk-pixbuf.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2117
+#include <gdk/gdkcolor.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2118
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2119
 G_BEGIN_DECLS
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2120
 
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2121
@@ -289,6 +290,14 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2122
 const char* wnck_window_get_name      (WnckWindow *window);
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  2123
 gboolean    wnck_window_has_icon_name (WnckWindow *window);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2124
 const char* wnck_window_get_icon_name (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2125
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2126
+const char* wnck_window_get_label	   (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2127
+char* wnck_window_get_label_human_readable (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2128
+GdkColor* wnck_window_get_label_color	   (WnckWindow *window);
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  2129
+const char* wnck_window_get_label_color_str	   (WnckWindow *window);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2130
+void wnck_window_update_label	       (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2131
+const char* wnck_window_get_role       (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2132
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2133
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2134
 WnckApplication* wnck_window_get_application  (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2135
 WnckWindow*      wnck_window_get_transient    (WnckWindow *window);
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2136
@@ -321,6 +330,9 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2137
 gboolean wnck_window_is_sticky                 (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2138
 gboolean wnck_window_needs_attention           (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2139
 gboolean wnck_window_or_transient_needs_attention (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2140
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2141
+gboolean wnck_window_is_trusted                (WnckWindow *window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2142
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2143
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2144
 void wnck_window_set_skip_pager    (WnckWindow *window,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2145
                                     gboolean skip);
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2146
diff -urN libwnck.orig/libwnck/wnck-tsol.c libwnck.new/libwnck/wnck-tsol.c
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2147
--- libwnck.orig/libwnck/wnck-tsol.c	1970-01-01 01:00:00.000000000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2148
+++ libwnck.new/libwnck/wnck-tsol.c	2008-08-06 23:43:40.140377000 +0100
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  2149
@@ -0,0 +1,289 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2150
+#include  <config.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2151
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2152
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2153
+#include <stdlib.h>
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  2154
+#include <strings.h>
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2155
+#include <dlfcn.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2156
+#include <link.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2157
+#include <glib.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2158
+#include "wnck-tsol.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2159
+#include "tsol-pics.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2160
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2161
+static
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2162
+void * dlopen_bsm (void)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2163
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2164
+	return dlopen ("/usr/lib/libbsm.so", RTLD_LAZY);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2165
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2166
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2167
+static
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2168
+void * dlopen_tsol (void)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2169
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2170
+   void  *handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2171
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2172
+   /*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2173
+    * No 64-bit version of libwnck so we can get away with hardcoding
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2174
+    * to a single path on this occasion
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2175
+    */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2176
+   if ((handle = dlopen ("/usr/lib/libtsol.so.2", RTLD_LAZY)) != NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2177
+       return handle;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2178
+   
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2179
+   return handle;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2180
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2181
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2182
+static
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2183
+void * dlopen_gnometsol (void)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2184
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2185
+   void  *handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2186
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2187
+   if ((handle = dlopen ("/usr/lib/libgnometsol.so", RTLD_LAZY)) != NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2188
+       return handle;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2189
+   
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2190
+   return handle;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2191
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2192
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2193
+static
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2194
+void * dlopen_xtsol (void)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2195
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2196
+   void  *handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2197
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2198
+   if ((handle = dlopen ("/usr/lib/libXtsol.so.1", RTLD_LAZY)) != NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2199
+       return handle;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2200
+   if ((handle = dlopen ("/usr/openwin/lib/libXtsol.so.1", RTLD_LAZY)) != NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2201
+       return handle;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2202
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2203
+   return handle;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2204
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2205
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2206
+gboolean
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2207
+_wnck_use_trusted_extensions (void)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2208
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2209
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2210
+  static int trusted = -1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2211
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2212
+  /*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2213
+   * Sun Trusted Extensions (tm) for Solaris (tm) support. 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2214
+   *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2215
+   * It is necessary to use dlopen because the label aware extensions to libwnck work
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2216
+   * only on systems with the trusted extensions installed and with the SUN_TSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2217
+   * xserver extension present
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2218
+   */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2219
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2220
+    if (trusted < 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2221
+      static gpointer bsm_handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2222
+      static gpointer tsol_handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2223
+      static gpointer xtsol_handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2224
+      static gpointer gnometsol_handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2225
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2226
+      if (getenv ("TRUSTED_SESSION") == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2227
+        trusted = 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2228
+        return 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2229
+      }   	
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2230
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2231
+		bsm_handle = dlopen_bsm ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2232
+        tsol_handle = dlopen_tsol ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2233
+		xtsol_handle = dlopen_xtsol ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2234
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2235
+        if (bsm_handle && tsol_handle && xtsol_handle) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2236
+           /* libbsm function (only interested in the one) */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2237
+           libbsm_getdevicerange = (bsm_getdevicerange) dlsym (bsm_handle, "getdevicerange");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2238
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2239
+           /* libtsol functions */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2240
+           libtsol_label_to_str = (tsol_label_to_str) dlsym (tsol_handle, "label_to_str");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2241
+           libtsol_str_to_label = (tsol_str_to_label) dlsym (tsol_handle, "str_to_label");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2242
+           libtsol_m_label_free = (tsol_m_label_free) dlsym (tsol_handle, "m_label_free");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2243
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2244
+           /* Other misc. libtsol functions */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2245
+           libtsol_blminimum = (tsol_blminimum) dlsym (tsol_handle, "blminimum");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2246
+           libtsol_blmaximum = (tsol_blmaximum) dlsym (tsol_handle, "blmaximum");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2247
+           libtsol_blinrange = (tsol_blinrange) dlsym (tsol_handle, "blinrange");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2248
+           libtsol_getuserrange = (tsol_getuserrange) dlsym (tsol_handle, "getuserrange");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2249
+           libtsol_blabel_alloc = (tsol_blabel_alloc) dlsym (tsol_handle, "blabel_alloc");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2250
+           libtsol_blabel_free  = (tsol_blabel_free)  dlsym (tsol_handle, "blabel_free");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2251
+           libtsol_bsllow  = (tsol_bsllow)  dlsym (tsol_handle, "bsllow");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2252
+           libtsol_bslhigh = (tsol_bslhigh) dlsym (tsol_handle, "bslhigh");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2253
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2254
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2255
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2256
+           /* libXtsol functions */
15579
d26c3d31b0bd 2009-04-07 Stephen Browne <[email protected]>
stephen
parents: 14986
diff changeset
  2257
+           libxtsol_XTSOLgetResLabel = (xtsol_XTSOLgetResLabel) dlsym (xtsol_handle,
d26c3d31b0bd 2009-04-07 Stephen Browne <[email protected]>
stephen
parents: 14986
diff changeset
  2258
+                                     "XTSOLgetResLabel");
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2259
+           libxtsol_XTSOLgetResUID = (xtsol_XTSOLgetResUID) dlsym (xtsol_handle,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2260
+                                     "XTSOLgetResUID");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2261
+           libxtsol_XTSOLgetWorkstationOwner = (xtsol_XTSOLgetWorkstationOwner) dlsym (xtsol_handle,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2262
+                                     "XTSOLgetWorkstationOwner");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2263
+           libxtsol_XTSOLIsWindowTrusted = (xtsol_XTSOLIsWindowTrusted) dlsym (xtsol_handle,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2264
+                                     "XTSOLIsWindowTrusted");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2265
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2266
+           if (libbsm_getdevicerange == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2267
+               libtsol_label_to_str == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2268
+               libtsol_str_to_label == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2269
+               libtsol_m_label_free == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2270
+               libtsol_blminimum == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2271
+               libtsol_blmaximum == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2272
+               libtsol_blinrange == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2273
+               libtsol_getuserrange == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2274
+               libtsol_blabel_alloc == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2275
+               libtsol_blabel_free  == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2276
+               libtsol_bsllow  == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2277
+               libtsol_bslhigh == NULL ||
15579
d26c3d31b0bd 2009-04-07 Stephen Browne <[email protected]>
stephen
parents: 14986
diff changeset
  2278
+               libxtsol_XTSOLgetResLabel == NULL ||
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2279
+               libxtsol_XTSOLgetResUID == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2280
+               libxtsol_XTSOLgetWorkstationOwner == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2281
+               libxtsol_XTSOLIsWindowTrusted == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2282
+               dlclose (bsm_handle);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2283
+               dlclose (tsol_handle);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2284
+               dlclose (xtsol_handle);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2285
+               bsm_handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2286
+               tsol_handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2287
+               xtsol_handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2288
+            }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2289
+        }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2290
+	gnometsol_handle = dlopen_gnometsol ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2291
+	if (gnometsol_handle != NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2292
+	  {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2293
+	    libgnome_tsol_constraint_image_render = (gnome_tsol_constraint_image_render) dlsym (gnometsol_handle, "gnome_tsol_constraint_image_render");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2294
+	    libgnome_tsol_constraint_image_set_border = (gnome_tsol_constraint_image_set_border) dlsym (gnometsol_handle, "gnome_tsol_constraint_image_set_border");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2295
+	    libgnome_tsol_constraint_image_set_stretch = (gnome_tsol_constraint_image_set_stretch) dlsym (gnometsol_handle, "gnome_tsol_constraint_image_set_stretch");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2296
+	    libgnome_tsol_constraint_image_colorize = (gnome_tsol_constraint_image_colorize) dlsym (gnometsol_handle, "gnome_tsol_constraint_image_colorize");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2297
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2298
+	    if (libgnome_tsol_constraint_image_render == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2299
+		libgnome_tsol_constraint_image_set_border == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2300
+		libgnome_tsol_constraint_image_set_stretch == NULL ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2301
+		libgnome_tsol_constraint_image_colorize == NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2302
+		gnometsol_handle = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2303
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2304
+	  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2305
+	trusted = ((bsm_handle != NULL) && (tsol_handle != NULL) && (xtsol_handle != NULL) && (gnometsol_handle != NULL)) ? 1 : 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2306
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2307
+    return trusted ? TRUE : FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2308
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2309
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2310
+const char *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2311
+_wnck_get_min_label ()
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2312
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2313
+    static char *min_label = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2314
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2315
+    if (!min_label) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2316
+        min_label = (char *) getenv ("USER_MIN_SL");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2317
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2318
+    return min_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2319
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2320
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2321
+const char*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2322
+_wnck_get_max_label()
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2323
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2324
+    static char *max_label = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2325
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2326
+    if (!max_label) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2327
+        max_label = (char *) getenv ("USER_MAX_SL");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2328
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2329
+    return max_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2330
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2331
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2332
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2333
+/* GFX part */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2334
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2335
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2336
+typedef struct _HighlightStripe HighlightStripe;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2337
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2338
+struct _HighlightStripe
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2339
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2340
+  ConstraintImage *image;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2341
+  char		  *name;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2342
+};
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2343
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2344
+static gint
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2345
+label_string_compare (HighlightStripe *tmp, char *searched_label)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2346
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2347
+  return strcmp (searched_label, tmp->name);  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2348
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2349
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2350
+ConstraintImage * 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2351
+get_highlight_stripe (char     *name,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2352
+		      GdkColor *label_color)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2353
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2354
+  static GSList *hl_stripe_list = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2355
+  GSList *stored_hl_stripe = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2356
+  HighlightStripe *hl_stripe;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2357
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2358
+  if ((name == NULL) || (label_color == NULL))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2359
+    return NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2360
+    
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2361
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2362
+  stored_hl_stripe = g_slist_find_custom (hl_stripe_list, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2363
+					  name, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2364
+					  (GCompareFunc)label_string_compare);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2365
+  if (stored_hl_stripe)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2366
+    return ((HighlightStripe* )stored_hl_stripe->data)->image;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2367
+ 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2368
+  hl_stripe = g_new0 (HighlightStripe, 1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2369
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2370
+  hl_stripe->name = g_strdup (name);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2371
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2372
+  hl_stripe->image = g_new0 (ConstraintImage, 1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2373
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2374
+  hl_stripe->image->pixbuf = gdk_pixbuf_new_from_inline (-1, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2375
+							  highlight_stripe_pb, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2376
+							  TRUE, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2377
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2378
+  libgnome_tsol_constraint_image_set_border (hl_stripe->image, 3, 0, 1, 1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2379
+  libgnome_tsol_constraint_image_set_stretch (hl_stripe->image, TRUE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2380
+  libgnome_tsol_constraint_image_colorize (hl_stripe->image, label_color, 255, TRUE);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2381
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2382
+  hl_stripe_list = g_slist_append (hl_stripe_list, hl_stripe);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2383
+  return hl_stripe->image; 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2384
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2385
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2386
+static gboolean label_expose_event (GtkWidget        *widget,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2387
+				    GdkEventExpose   *event,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2388
+				    gpointer          data)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2389
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2390
+  WnckWindow *window = (WnckWindow *) data;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2391
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2392
+  GdkGC *tmp_gc = gdk_gc_new (widget->window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2393
+  gdk_gc_set_rgb_fg_color (tmp_gc, wnck_window_get_label_color (window));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2394
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2395
+  gdk_draw_rectangle (widget->window, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2396
+		      widget->style->black_gc,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2397
+		      FALSE,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2398
+		      event->area.x, event->area.y,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2399
+		      event->area.width - 1, event->area.height - 1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2400
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2401
+  gdk_draw_rectangle (widget->window, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2402
+		      tmp_gc,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2403
+		      TRUE,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2404
+		      event->area.x + 1, event->area.y + 1,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2405
+		      event->area.width - 2, event->area.height - 2);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2406
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2407
+  g_object_unref (tmp_gc);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2408
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2409
+  return FALSE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2410
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2411
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2412
+GtkWidget *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2413
+window_menu_create_label_indicator (WnckWindow *window, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2414
+				    GtkWidget  *image)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2415
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2416
+  GtkWidget *da, *hbox;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2417
+  da = gtk_drawing_area_new ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2418
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2419
+  g_signal_connect (G_OBJECT (da), "expose_event",  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2420
+		    G_CALLBACK (label_expose_event), 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2421
+		    window);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2422
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2423
+  gtk_widget_set_size_request (da, 5, -1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2424
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2425
+  hbox = gtk_hbox_new (FALSE, 4);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2426
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2427
+  gtk_container_add (GTK_CONTAINER (hbox), da);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2428
+  gtk_container_add (GTK_CONTAINER (hbox), image);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2429
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2430
+  gtk_widget_show (da);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2431
+  gtk_widget_show (hbox);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2432
+  gtk_widget_show (image);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2433
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2434
+  return hbox;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2435
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2436
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2437
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2438
+#endif /* HAVE_XTSOL */
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2439
diff -urN libwnck.orig/libwnck/wnck-tsol.h libwnck.new/libwnck/wnck-tsol.h
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2440
--- libwnck.orig/libwnck/wnck-tsol.h	1970-01-01 01:00:00.000000000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2441
+++ libwnck.new/libwnck/wnck-tsol.h	2008-08-06 23:43:40.142752000 +0100
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2442
@@ -0,0 +1,133 @@
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2443
+#ifndef __WNCK_TSOL_H__
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2444
+#define __WNCK_TSOL_H__
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2445
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2446
+#include <config.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2447
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2448
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2449
+#include <pwd.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2450
+#include <glib-2.0/glib.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2451
+#include <tsol/label.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2452
+#include <sys/tsol/label_macro.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2453
+#include <X11/Xlib.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2454
+#include <X11/extensions/Xtsol.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2455
+#include <gtk/gtk.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2456
+#include "libwnck.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2457
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2458
+typedef struct _ConstraintImage ConstraintImage;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2459
+struct _ConstraintImage
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2460
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2461
+  gchar     *filename;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2462
+  GdkPixbuf *pixbuf;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2463
+  GdkPixbuf *scaled;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2464
+  gboolean   stretch;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2465
+  gint       border_left;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2466
+  gint       border_right;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2467
+  gint       border_bottom;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2468
+  gint       border_top;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2469
+  guint      hints[3][3];
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2470
+  gboolean   recolorable;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2471
+  GdkColor   colorize_color;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2472
+  gboolean   use_as_bkg_mask;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2473
+};
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2474
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2475
+/* libbsm provides getdevicerange(3TSOL) - don't believe the man page */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2476
+typedef blrange_t*	(*bsm_getdevicerange) (const char *device);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2477
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2478
+/* Libtsol functions */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2479
+typedef int     (*tsol_label_to_str) (const m_label_t *label, char **string,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2480
+				      const m_label_str_t conversion_type, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2481
+				      uint_t flags);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2482
+typedef int	(*tsol_str_to_label) (const char *string, m_label_t **label,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2483
+				      const m_label_type_t label_type, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2484
+				      uint_t flags,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2485
+				      int *error);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2486
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2487
+typedef void	(*tsol_m_label_free) (m_label_t *label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2488
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2489
+/* Other misc. libtsol functions */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2490
+typedef blrange_t*	(*tsol_getuserrange) (const char *username);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2491
+typedef int		(*tsol_blinrange)    (const m_label_t *label,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2492
+					      const blrange_t *range);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2493
+typedef void		(*tsol_blminimum)    (m_label_t *minimum_label,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2494
+					      const m_label_t *bounding_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2495
+typedef void		(*tsol_blmaximum)    (m_label_t *maximum_label,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2496
+					      const m_label_t *bounding_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2497
+typedef m_label_t*	(*tsol_blabel_alloc) (void);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2498
+typedef void		(*tsol_blabel_free)  (m_label_t *label_p);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2499
+typedef void		(*tsol_bsllow)  (m_label_t *label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2500
+typedef void		(*tsol_bslhigh) (m_label_t *label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2501
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2502
+/* libXtsol functions */
15579
d26c3d31b0bd 2009-04-07 Stephen Browne <[email protected]>
stephen
parents: 14986
diff changeset
  2503
+typedef Status	(*xtsol_XTSOLgetResLabel) (Display *dpy, XID xid,
d26c3d31b0bd 2009-04-07 Stephen Browne <[email protected]>
stephen
parents: 14986
diff changeset
  2504
+                 ResourceType resourceFlag, bslabel_t *sl);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2505
+typedef Status	(*xtsol_XTSOLgetResUID) (Display *dpy, XID object,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2506
+                 ResourceType resourceFlag,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2507
+                 uid_t *uidp);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2508
+typedef Status	(*xtsol_XTSOLgetWorkstationOwner) (Display *dpy, uid_t *uidp);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2509
+typedef Bool    (*xtsol_XTSOLIsWindowTrusted) (Display *dpy, Window win); 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2510
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2511
+/* libgnometsol functions */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2512
+typedef void  (*gnome_tsol_constraint_image_render) (ConstraintImage *cimage,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2513
+						     GdkWindow    *window,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2514
+						     GdkBitmap    *mask,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2515
+						     GdkRectangle *clip_rect,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2516
+						     gboolean      center,		   
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2517
+						     gint          x,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2518
+						     gint          y,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2519
+						     gint          width,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2520
+						     gint          height);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2521
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2522
+typedef void (*gnome_tsol_constraint_image_set_border) (ConstraintImage *pb,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2523
+							gint         left,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2524
+							gint         right,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2525
+							gint         top,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2526
+							gint         bottom);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2527
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2528
+typedef void (*gnome_tsol_constraint_image_set_stretch) (ConstraintImage *pb,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2529
+							 gboolean     stretch);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2530
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2531
+typedef void (*gnome_tsol_constraint_image_colorize) (ConstraintImage *image,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2532
+						      GdkColor  *color,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2533
+						      int	alpha,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2534
+						      gboolean   use_alpha);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2535
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2536
+/* libbsm functions */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2537
+bsm_getdevicerange	libbsm_getdevicerange;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2538
+/* libtsol functions*/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2539
+tsol_label_to_str	libtsol_label_to_str;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2540
+tsol_str_to_label	libtsol_str_to_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2541
+tsol_m_label_free	libtsol_m_label_free;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2542
+/* Other misc. libtsol functions */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2543
+tsol_blminimum		libtsol_blminimum;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2544
+tsol_blmaximum		libtsol_blmaximum;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2545
+tsol_blinrange      libtsol_blinrange;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2546
+tsol_getuserrange	libtsol_getuserrange;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2547
+tsol_blabel_alloc	libtsol_blabel_alloc;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2548
+tsol_blabel_free	libtsol_blabel_free;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2549
+tsol_bsllow			libtsol_bsllow;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2550
+tsol_bslhigh		libtsol_bslhigh;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2551
+
15579
d26c3d31b0bd 2009-04-07 Stephen Browne <[email protected]>
stephen
parents: 14986
diff changeset
  2552
+xtsol_XTSOLgetResLabel	libxtsol_XTSOLgetResLabel;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2553
+xtsol_XTSOLgetResUID	libxtsol_XTSOLgetResUID;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2554
+xtsol_XTSOLgetWorkstationOwner	libxtsol_XTSOLgetWorkstationOwner;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2555
+xtsol_XTSOLIsWindowTrusted	libxtsol_XTSOLIsWindowTrusted;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2556
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2557
+gnome_tsol_constraint_image_render libgnome_tsol_constraint_image_render;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2558
+gnome_tsol_constraint_image_set_border libgnome_tsol_constraint_image_set_border;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2559
+gnome_tsol_constraint_image_set_stretch libgnome_tsol_constraint_image_set_stretch;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2560
+gnome_tsol_constraint_image_colorize libgnome_tsol_constraint_image_colorize;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2561
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2562
+const char* _wnck_get_min_label ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2563
+const char* _wnck_get_max_label ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2564
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2565
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2566
+/* GFX part */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2567
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2568
+ConstraintImage* get_highlight_stripe (char*	  name,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2569
+				       GdkColor*  label_color);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2570
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2571
+GtkWidget*	 window_menu_create_label_indicator (WnckWindow *window, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2572
+						     GtkWidget  *image);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2573
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2574
+#endif /* HAVE_XTSOL */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2575
+#endif
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2576
diff -urN libwnck.orig/libwnck/workspace.c libwnck.new/libwnck/workspace.c
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2577
--- libwnck.orig/libwnck/workspace.c	2008-08-06 23:43:13.502854000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2578
+++ libwnck.new/libwnck/workspace.c	2008-08-06 23:51:01.138260000 +0100
10691
b96e2e769e2b 2007-10-23 Stephen Browne <[email protected]>
stephen
parents: 10237
diff changeset
  2579
@@ -26,6 +26,16 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2580
 #include <config.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2581
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2582
 #include <glib/gi18n-lib.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2583
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2584
+#include <stdlib.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2585
+#include <sys/types.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2586
+#include <unistd.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2587
+#include <user_attr.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2588
+#include <X11/Xlib.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2589
+#include <X11/extensions/Xtsol.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2590
+#include <libgnometsol/userattr.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2591
+#include <wnck-tsol.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2592
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2593
 #include "workspace.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2594
 #include "xutils.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2595
 #include "private.h"
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2596
@@ -69,6 +79,13 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2597
   WnckScreen *screen;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2598
   int number;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2599
   char *name;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2600
+#ifdef HAVE_XTSOL  /* TSOL */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2601
+  char *label; /* Workspace sensitivity label */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2602
+  char *role;  /* Workspace role : login name. Set only once */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2603
+  /* The workspace range can differ for Workstation Owner and role workspaces */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2604
+  const blrange_t *ws_range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2605
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2606
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2607
   int width, height;            /* Workspace size */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2608
   int viewport_x, viewport_y;   /* Viewport origin */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2609
   gboolean is_virtual;
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2610
@@ -79,6 +96,10 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2611
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2612
 enum {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2613
   NAME_CHANGED,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2614
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2615
+  LABEL_CHANGED,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2616
+  ROLE_CHANGED,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2617
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2618
   LAST_SIGNAL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2619
 };
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2620
 
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2621
@@ -91,6 +112,12 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2622
 
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  2623
 static guint signals[LAST_SIGNAL] = { 0 };
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2624
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2625
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2626
+static void emit_label_changed (WnckWorkspace *space);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2627
+static void emit_role_changed (WnckWorkspace *space);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2628
+static blrange_t * get_display_range (void);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2629
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2630
+
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  2631
 static void
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  2632
 wnck_workspace_init (WnckWorkspace *workspace)
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  2633
 {
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2634
@@ -104,6 +131,9 @@
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  2635
   workspace->priv->viewport_x = 0;
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  2636
   workspace->priv->viewport_y = 0;
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  2637
   workspace->priv->is_virtual = FALSE;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2638
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2639
+  workspace->priv->ws_range = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2640
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2641
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2642
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2643
 static void
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2644
@@ -129,6 +159,24 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2645
                   NULL, NULL,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2646
                   g_cclosure_marshal_VOID__VOID,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2647
                   G_TYPE_NONE, 0);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2648
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2649
+  signals[LABEL_CHANGED] =
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2650
+    g_signal_new ("label_changed",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2651
+                  G_OBJECT_CLASS_TYPE (object_class),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2652
+                  G_SIGNAL_RUN_LAST,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2653
+                  G_STRUCT_OFFSET (WnckWorkspaceClass, label_changed),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2654
+                  NULL, NULL,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2655
+                  g_cclosure_marshal_VOID__VOID,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2656
+                  G_TYPE_NONE, 0);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2657
+  signals[ROLE_CHANGED] =
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2658
+    g_signal_new ("role_changed",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2659
+                  G_OBJECT_CLASS_TYPE (object_class),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2660
+                  G_SIGNAL_RUN_LAST,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2661
+                  G_STRUCT_OFFSET (WnckWorkspaceClass, role_changed),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2662
+                  NULL, NULL,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2663
+                  g_cclosure_marshal_VOID__VOID,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2664
+                  G_TYPE_NONE, 0);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2665
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2666
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2667
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2668
 static void
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2669
@@ -140,6 +188,11 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2670
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2671
   g_free (workspace->priv->name);
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  2672
   workspace->priv->name = NULL;
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  2673
+
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2674
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2675
+  g_free (workspace->priv->role);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2676
+  g_free (workspace->priv->label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2677
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2678
   
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  2679
   G_OBJECT_CLASS (wnck_workspace_parent_class)->finalize (object);
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  2680
 }
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2681
@@ -179,6 +232,134 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2682
   return space->priv->name;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2683
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2684
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2685
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2686
+/**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2687
+ * wnck_workspace_get_label_range:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2688
+ * @space: a #WnckWorkspace
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2689
+ * @min_label: a string pointer to pointer to the minimum valid label value for @space
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2690
+ * @max_label: a string pointer to pointer to the maximum valid label value for @space
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2691
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2692
+ * Gets the sensitivity label range for the specified workspace when
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2693
+ * running in a label aware desktop session. @min_label represents the minimum
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2694
+ * sensitivity label that the #WnckWorkspace, @space, may be assigned.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2695
+ * @max_label represents the maximum sensitivity label thatthe #WnckWorkspace,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2696
+ * @space may be assigned. Both min_label and max_label are allocated memory
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2697
+ * on behalf of the caller. It is the caller's responsibility to free the memory
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2698
+ * pointed to by @min_label and @max_label.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2699
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2700
+ * Return value: 0 on success, non zero on failure.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2701
+ **/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2702
+int
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2703
+wnck_workspace_get_label_range (WnckWorkspace *space, char **min_label, char **max_label)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2704
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2705
+  int error = 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2706
+  blrange_t *brange;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2707
+  g_return_val_if_fail (WNCK_IS_WORKSPACE (space), -1);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2708
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2709
+  if (! _wnck_check_xtsol_extension ())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2710
+      return -1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2711
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2712
+  if (!_wnck_use_trusted_extensions())
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2713
+      return -1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2714
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2715
+  brange = _wnck_workspace_get_range (space);
10691
b96e2e769e2b 2007-10-23 Stephen Browne <[email protected]>
stephen
parents: 10237
diff changeset
  2716
+  if (!brange)
b96e2e769e2b 2007-10-23 Stephen Browne <[email protected]>
stephen
parents: 10237
diff changeset
  2717
+      return -1;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2718
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2719
+  if (libtsol_label_to_str (brange->lower_bound, min_label, M_INTERNAL,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2720
+                        LONG_NAMES) != 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2721
+      g_warning ("wnck_workspace_get_label_range: Workspace has an invalid minimum label bound");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2722
+      return -1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2723
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2724
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2725
+  if (libtsol_label_to_str (brange->upper_bound, max_label, M_INTERNAL,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2726
+                        LONG_NAMES) != 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2727
+      g_warning ("wnck_workspace_get_label_range: Workspace has an invalid maximum label bound");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2728
+      return -1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2729
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2730
+  return 0;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2731
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2732
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2733
+/**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2734
+ * wnck_workspace_get_label:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2735
+ * @space: a #WnckWorkspace
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2736
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2737
+ * Gets the sensitivity label as an hex number for the specified 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2738
+ * workspace when running in a label aware desktop session.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2739
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2740
+ * Return value: workspace sensitivity label, %NULL on failure.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2741
+ **/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2742
+const char*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2743
+wnck_workspace_get_label (WnckWorkspace *space)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2744
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2745
+  g_return_val_if_fail (WNCK_IS_WORKSPACE (space), NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2746
+  /* A bit anal perhaps but I'd rather make sure nothing useful is returned */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2747
+  if (! (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions()) )
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2748
+    return NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2749
+  return space->priv->label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2750
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2751
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2752
+/**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2753
+ * wnck_workspace_get_human_readable_label:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2754
+ * @space: a #WnckWorkspace
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2755
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2756
+ * Gets the sensitivity label as a string for the specified workspace when
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2757
+ * running in a label aware desktop session.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2758
+ * 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2759
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2760
+ * Return value: workspace sensitivity label, %NULL on failure.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2761
+ **/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2762
+char*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2763
+wnck_workspace_get_human_readable_label (WnckWorkspace *space)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2764
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2765
+  const char *hex_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2766
+  char *human_readable_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2767
+  int error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2768
+  m_label_t *mlabel = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2769
+  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2770
+  g_return_val_if_fail (WNCK_IS_WORKSPACE (space), NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2771
+  if (! (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions()) )
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2772
+    return NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2773
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2774
+  hex_label = space->priv->label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2775
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2776
+  if (hex_label && (error = libtsol_str_to_label (hex_label, &mlabel, MAC_LABEL, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2777
+			    L_NO_CORRECTION, &error) == 0))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2778
+    {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2779
+      error = libtsol_label_to_str (mlabel, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2780
+			    &human_readable_label, 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2781
+			    M_LABEL, DEF_NAMES);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2782
+      if (strcmp (human_readable_label, "ADMIN_HIGH") == 0 ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2783
+	  strcmp (human_readable_label, "ADMIN_LOW") == 0)
9275
79e80db48461 2007-02-14 Takao Fujiwara <[email protected]>
fujiwara
parents: 8584
diff changeset
  2784
+	/* SUN_BRANDING TJDS */
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2785
+	return g_strdup (_("Trusted Path"));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2786
+      return human_readable_label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2787
+    }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2788
+  return NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2789
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2790
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2791
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2792
+/**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2793
+ * wnck_workspace_get_role:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2794
+ * @space: a #WnckWorkspace
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2795
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2796
+ * Gets the role (login name) for the specified workspace when
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2797
+ * running in a trusted desktop session.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2798
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2799
+ * Return value: workspace user role, %NULL on failure.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2800
+ **/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2801
+const char*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2802
+wnck_workspace_get_role (WnckWorkspace *space)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2803
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2804
+  g_return_val_if_fail (WNCK_IS_WORKSPACE (space), NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2805
+  /* Make sure to return NULL for non-tsol */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2806
+  if (! (_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions()) )
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2807
+    return NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2808
+  return space->priv->role;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2809
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2810
+#endif /* HAVE_XTSOL */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2811
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2812
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2813
 /**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2814
  * wnck_workspace_change_name:
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  2815
  * @space: a #WnckWorkspace.
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2816
@@ -217,6 +398,29 @@
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  2817
   return space->priv->screen;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2818
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2819
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2820
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2821
+/**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2822
+ * wnck_workspace_change_label:
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2823
+ * @space: a #WnckWorkspace
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2824
+ * @label: new workspace sensitivity label
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2825
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2826
+ * Try changing the sensitivity label of the workspace.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2827
+ *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2828
+ **/
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2829
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2830
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2831
+wnck_workspace_change_label (WnckWorkspace *space,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2832
+                             const char    *label)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2833
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2834
+  g_return_if_fail (WNCK_IS_WORKSPACE (space));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2835
+  g_return_if_fail (label != NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2836
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2837
+  _wnck_screen_change_workspace_label (space->priv->screen,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2838
+                                       space->priv->number,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2839
+                                       label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2840
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2841
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2842
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2843
 /**
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2844
  * wnck_workspace_activate:
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  2845
  * @space: a #WnckWorkspace.
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2846
@@ -254,6 +458,7 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2847
   space->priv->screen = screen;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2848
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2849
   _wnck_workspace_update_name (space, NULL);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2850
+/* FIXME - do label and role need to be updated here? */  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2851
   
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2852
   /* Just set reasonable defaults */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2853
   space->priv->width = wnck_screen_get_width (screen);
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2854
@@ -289,6 +494,251 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2855
   g_free (old);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2856
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2857
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2858
+#ifdef HAVE_XTSOL
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2859
+
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2860
+static char*
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2861
+get_workstationowner (void)
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2862
+{
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2863
+  static char *workstationowner = NULL;
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2864
+  uid_t wsuid;
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2865
+  struct passwd *pwd;
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2866
+
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2867
+  if (workstationowner == NULL) {
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2868
+    if ((libxtsol_XTSOLgetWorkstationOwner (gdk_x11_get_default_xdisplay (),
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2869
+					    &wsuid)) < 0) {
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2870
+      g_warning ("XTSOLgetWorkstationOwner() failed. Using getuid() instead");
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2871
+      pwd = getpwuid (getuid ());
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2872
+    } else {
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2873
+      pwd = getpwuid (wsuid);
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2874
+    }
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2875
+    
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2876
+    workstationowner = g_strdup (pwd->pw_name);
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2877
+  }
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2878
+ 
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2879
+  return workstationowner;
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2880
+}
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2881
+
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2882
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2883
+_wnck_workspace_update_label (WnckWorkspace *space,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2884
+                              const char    *label)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2885
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2886
+  char *old;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2887
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2888
+  g_return_if_fail (WNCK_IS_WORKSPACE (space));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2889
+  /* Don't do anything unless this is a trusted system */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2890
+  if (!(_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions()))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2891
+      return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2892
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2893
+  /* Should a warning be called here? */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2894
+  if (label == NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2895
+	g_warning("Workspace %d label is null\n",
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2896
+                   wnck_workspace_get_number (space));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2897
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2898
+  old = space->priv->label;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2899
+  space->priv->label = g_strdup (label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2900
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2901
+  /*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2902
+   *Initialise the label range for this workspace
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2903
+   */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2904
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2905
+  if (!space->priv->ws_range) {
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2906
+      if ((!space->priv->role) || (strlen (space->priv->role) == 0) ||
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2907
+	   (strcmp (space->priv->role, get_workstationowner ()) == 0)) {
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2908
+          blrange_t		*range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2909
+          int error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2910
+          char *min_label = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2911
+          char *max_label = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2912
+          range = g_malloc (sizeof (blrange_t));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2913
+          range->lower_bound = range->upper_bound = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2914
+     
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2915
+          min_label = g_strdup (_wnck_get_min_label ());
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2916
+          max_label = g_strdup (_wnck_get_max_label ());
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2917
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2918
+          if (libtsol_str_to_label (min_label, &(range->lower_bound),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2919
+                                    MAC_LABEL, L_NO_CORRECTION, &error) < 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2920
+              g_warning ("Couldn't determine minimum workspace label");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2921
+              g_free (min_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2922
+              g_free (max_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2923
+              return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2924
+          }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2925
+          if (libtsol_str_to_label (max_label, &(range->upper_bound),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2926
+                                    USER_CLEAR, L_NO_CORRECTION, &error) < 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2927
+              g_warning ("Couldn't determine workspace clearance");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2928
+              g_free (min_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2929
+              g_free (max_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2930
+              return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2931
+          }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2932
+          space->priv->ws_range = range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2933
+          g_free (min_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2934
+          g_free (max_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2935
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2936
+      } else {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2937
+          int           error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2938
+          blrange_t     *role_range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2939
+          blrange_t		*disp_range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2940
+          userattr_t	*u_ent; 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2941
+          /* 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2942
+           * This is a role workspace so we need to construct the correct label range
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2943
+           * instead of relying on USER_MIN_SL and USER_MAX_SL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2944
+           */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2945
+          if ((role_range = libtsol_getuserrange (space->priv->role)) == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2946
+              g_warning ("Couldn't get label range for %s\n", space->priv->role);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2947
+              return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2948
+          }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2949
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2950
+    	  /* Get display device's range */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2951
+    	  if ((disp_range = get_display_range ()) == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2952
+    		  g_warning ("Couldn't get the display's device range");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2953
+    		  return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2954
+    	  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2955
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2956
+          /*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2957
+           * Determine the low & high bound of the label range
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2958
+           * where the role user can operate. This is the
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2959
+           * intersection of display label range & role label
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2960
+           * range.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2961
+           */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2962
+          libtsol_blmaximum (role_range->lower_bound, disp_range->lower_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2963
+          libtsol_blminimum (role_range->upper_bound, disp_range->upper_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2964
+          space->priv->ws_range = role_range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2965
+          libtsol_blabel_free (disp_range->lower_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2966
+          libtsol_blabel_free (disp_range->upper_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2967
+          free (disp_range);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2968
+      }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2969
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2970
+  /* Should we put a g_warning here? */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2971
+  /* if (space->priv->label == NULL) */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2972
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2973
+  if ((!old && label) ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2974
+      (old && label && strcmp (old, label) != 0))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2975
+    emit_label_changed (space);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2976
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2977
+  g_free (old);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2978
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2979
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2980
+void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2981
+_wnck_workspace_update_role (WnckWorkspace *space,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2982
+                             const char    *role)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2983
+{
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2984
+	char *workstationowner = NULL;
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2985
+	char *old;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2986
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2987
+	g_return_if_fail (WNCK_IS_WORKSPACE (space));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2988
+	/* Check for a multi label trusted environment first */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2989
+	if (!(_wnck_check_xtsol_extension() && _wnck_use_trusted_extensions()))
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2990
+		return;
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  2991
+	workstationowner = get_workstationowner ();
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2992
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2993
+	if (role == NULL)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2994
+		return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2995
+	old = space->priv->role;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2996
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2997
+	/* Check the the workspace role really is changing */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2998
+	if ((!old && role) ||
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  2999
+		(old && role && strcmp (old, role) != 0)) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3000
+		g_free (space->priv->role);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3001
+		if (strlen (role) ==0)
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  3002
+			{ space->priv->role = g_strdup (workstationowner); return;}
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3003
+		else
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3004
+			space->priv->role = g_strdup (role);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3005
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3006
+		/*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3007
+		 * A role change requires that the label range of the 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3008
+		 * workspace be reset. The label also needs to be 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3009
+		 * silently set to the lowest in the range.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3010
+		 */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3011
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3012
+		if (space->priv->ws_range) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3013
+			libtsol_blabel_free (space->priv->ws_range->lower_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3014
+			libtsol_blabel_free (space->priv->ws_range->upper_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3015
+			/* FIXME - man pages tell me to use free but generates a compiler warning */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3016
+			free ((void *)space->priv->ws_range);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3017
+		}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3018
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3019
+		if (strcmp (space->priv->role, workstationowner) == 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3020
+			/* Workstation owner, so it's not a real role */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3021
+			blrange_t		*range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3022
+			int error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3023
+			char *min_label = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3024
+			char *max_label = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3025
+			range = g_malloc (sizeof (blrange_t));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3026
+			range->lower_bound = range->upper_bound = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3027
+ 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3028
+			min_label = g_strdup (_wnck_get_min_label ());
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3029
+			max_label = g_strdup (_wnck_get_max_label ());
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3030
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3031
+			/* Workspace label must be reset by default to the min_label value */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3032
+			if (space->priv->label)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3033
+				g_free (space->priv->label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3034
+				space->priv->label = g_strdup (min_label);  
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3035
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3036
+			if (libtsol_str_to_label (min_label, &(range->lower_bound),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3037
+					MAC_LABEL, L_NO_CORRECTION, &error) < 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3038
+				g_warning ("Couldn't determine minimum workspace label");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3039
+				g_free (min_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3040
+				g_free (max_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3041
+				return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3042
+			}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3043
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3044
+			if (libtsol_str_to_label (max_label, &(range->upper_bound),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3045
+				USER_CLEAR, L_NO_CORRECTION, &error) < 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3046
+				g_warning ("Couldn't determine workspace clearance");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3047
+				g_free (min_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3048
+				g_free (max_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3049
+				return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3050
+    	  	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3051
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3052
+			space->priv->ws_range = range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3053
+			g_free (min_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3054
+			g_free (max_label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3055
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3056
+		} else {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3057
+			int           error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3058
+			blrange_t     *role_range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3059
+			blrange_t		*disp_range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3060
+			userattr_t	*u_ent;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3061
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3062
+			/* 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3063
+			 * This is a role workspace so we need to construct the correct label range
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3064
+			 * instead of relying on USER_MIN_SL and USER_MAX_SL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3065
+			 */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3066
+			if ((role_range = libtsol_getuserrange (space->priv->role)) == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3067
+				g_warning ("Couldn't get label range for %s\n", space->priv->role);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3068
+				return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3069
+			}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3070
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3071
+			/* Get display device's range */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3072
+			if ((disp_range = get_display_range ()) == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3073
+				g_warning ("Couldn't get the display's device range");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3074
+				return;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3075
+			}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3076
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3077
+			/*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3078
+			 * Determine the low & high bound of the label range
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3079
+			 * where the role user can operate. This is the
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3080
+			 * intersection of display label range & role label
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3081
+			 * range.
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3082
+			 */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3083
+			libtsol_blmaximum (role_range->lower_bound, disp_range->lower_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3084
+			libtsol_blminimum (role_range->upper_bound, disp_range->upper_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3085
+			space->priv->ws_range = role_range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3086
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3087
+			/* Workspace label must be reset by default to the lower_bound value */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3088
+			if (libtsol_label_to_str (role_range->lower_bound, &space->priv->label, M_INTERNAL,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3089
+					LONG_NAMES) != 0) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3090
+				/* Weird - default to admin_low */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3091
+        		space->priv->label = g_strup ("ADMIN_LOW");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3092
+			}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3093
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3094
+			libtsol_blabel_free (disp_range->lower_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3095
+			libtsol_blabel_free (disp_range->upper_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3096
+			free (disp_range);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3097
+		}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3098
+    	emit_role_changed (space);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3099
+	}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3100
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3101
+#endif /* HAVE_XTSOL */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3102
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3103
 static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3104
 emit_name_changed (WnckWorkspace *space)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3105
 {
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3106
@@ -297,6 +747,24 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3107
                  0);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3108
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3109
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3110
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3111
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3112
+emit_label_changed (WnckWorkspace *space)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3113
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3114
+  g_signal_emit (G_OBJECT (space),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3115
+                 signals[LABEL_CHANGED],
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3116
+                 0);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3117
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3118
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3119
+static void
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3120
+emit_role_changed (WnckWorkspace *space)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3121
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3122
+  g_signal_emit (G_OBJECT (space),
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3123
+                 signals[ROLE_CHANGED],
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3124
+                 0);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3125
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3126
+#endif /* HAVE_XTSOL */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3127
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3128
 gboolean
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3129
 _wnck_workspace_set_geometry (WnckWorkspace *space,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3130
                               int            w,
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3131
@@ -612,3 +1080,33 @@
10129
9ff6246ac3ea 2007-06-27 Erwann Chenede - <[email protected]>
erwannc
parents: 10012
diff changeset
  3132
 
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  3133
   return wnck_screen_get_workspace (space->priv->screen, index);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3134
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3135
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3136
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3137
+/*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3138
+ * These private (hint hint) functions assume that they have been called
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3139
+ * from within a trusted desktop session. The caller must ensure that
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3140
+ * this is the case otherwise it will trigger a load of the potentially
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3141
+ * non existant tsol and xtsol libs. That would be bad!
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3142
+ */
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3143
+static blrange_t *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3144
+get_display_range (void)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3145
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3146
+  blrange_t       *range = NULL;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3147
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3148
+  range = libbsm_getdevicerange ("framebuffer");
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3149
+  if (range == NULL) {
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3150
+    range = g_malloc (sizeof (blrange_t));
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3151
+    range->lower_bound = libtsol_blabel_alloc ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3152
+    range->upper_bound = libtsol_blabel_alloc ();
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3153
+    libtsol_bsllow  (range->lower_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3154
+    libtsol_bslhigh (range->upper_bound);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3155
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3156
+  return (range);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3157
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3158
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3159
+blrange_t *
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3160
+_wnck_workspace_get_range (WnckWorkspace *space)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3161
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3162
+  return space->priv->ws_range;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3163
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3164
+#endif
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3165
diff -urN libwnck.orig/libwnck/workspace.h libwnck.new/libwnck/workspace.h
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3166
--- libwnck.orig/libwnck/workspace.h	2008-08-06 23:43:13.464638000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3167
+++ libwnck.new/libwnck/workspace.h	2008-08-06 23:43:40.159050000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3168
@@ -57,6 +57,11 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3169
   GObjectClass parent_class;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3170
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3171
   void (* name_changed) (WnckWorkspace *space);
10012
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3172
+
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3173
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3174
+  void (* label_changed) (WnckWorkspace *space);
8535
d279148315f6 2006-11-10 Niall Power <[email protected]>
niall
parents: 7550
diff changeset
  3175
+  void (* role_changed)  (WnckWorkspace *space);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3176
+#endif
10012
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3177
   
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3178
   /* Padding for future expansion */
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3179
   void (* pad1) (void);
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3180
@@ -69,9 +74,22 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3181
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3182
 int         wnck_workspace_get_number     (WnckWorkspace *space);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3183
 const char* wnck_workspace_get_name       (WnckWorkspace *space);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3184
+#ifdef HAVE_XTSOL
10012
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3185
+int        wnck_workspace_get_label_range(WnckWorkspace *space,
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3186
+                                          char **min_label,
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3187
+                                          char **max_label);
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3188
+const char*        wnck_workspace_get_label      (WnckWorkspace *space);
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3189
+char*      wnck_workspace_get_human_readable_label (WnckWorkspace *space);
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3190
+const char*        wnck_workspace_get_role       (WnckWorkspace *space);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3191
+#endif
10012
cd518aaf1fbd 2007-06-07 Damien Carbery <[email protected]>
dcarbery
parents: 9988
diff changeset
  3192
+
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3193
 void        wnck_workspace_change_name    (WnckWorkspace *space,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3194
                                            const char    *name);
10174
976567cd296b 2007-07-10 Damien Carbery <[email protected]>
dcarbery
parents: 10129
diff changeset
  3195
 WnckScreen* wnck_workspace_get_screen     (WnckWorkspace *space);
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3196
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3197
+void        wnck_workspace_change_label   (WnckWorkspace *space,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3198
+                                           const char    *label);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3199
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3200
 void        wnck_workspace_activate       (WnckWorkspace *space,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3201
                                            guint32        timestamp);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3202
 int         wnck_workspace_get_width      (WnckWorkspace *space);
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3203
diff -urN libwnck.orig/libwnck/xutils.c libwnck.new/libwnck/xutils.c
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3204
--- libwnck.orig/libwnck/xutils.c	2008-08-06 23:43:13.631420000 +0100
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3205
+++ libwnck.new/libwnck/xutils.c	2008-08-06 23:43:40.166864000 +0100
11201
8006543a9274 2007-11-15 Erwann Chenede - <[email protected]>
erwannc
parents: 11190
diff changeset
  3206
@@ -27,6 +27,7 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3207
 #include <stdio.h>
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3208
 #include "screen.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3209
 #include "window.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3210
+#include "wnck-tsol.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3211
 #include "private.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3212
 #include "inlinepixbufs.h"
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3213
 
13074
b2e25f3981b4 2008-08-07 Stephen Browne <[email protected]>
stephen
parents: 12160
diff changeset
  3214
@@ -231,6 +232,21 @@
7480
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3215
   return TRUE;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3216
 }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3217
 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3218
+#ifdef HAVE_XTSOL
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3219
+gboolean
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3220
+_wnck_check_xtsol_extension ()
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3221
+{
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3222
+  static int foundxtsol = -1;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3223
+  int major_code, first_event, first_error;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3224
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3225
+  if (foundxtsol < 0) { 
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3226
+      foundxtsol = XQueryExtension (gdk_display, "SUN_TSOL", &major_code,
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3227
+                                    &first_event, &first_error);
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3228
+  }
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3229
+  return foundxtsol;
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3230
+}
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3231
+#endif
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3232
+
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3233
 static char*
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3234
 text_property_to_utf8 (const XTextProperty *prop)
32bf6cf3aae0 2006-06-22 Niall Power <[email protected]>
np93678
parents:
diff changeset
  3235
 {
17793
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3236
diff -ruN libwnck-2.30.0.orig/libwnck/Makefile.am libwnck-2.30.0/libwnck/Makefile.am
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3237
--- libwnck-2.30.0.orig/libwnck/Makefile.am	2010-04-03 21:06:32.639895227 +0100
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3238
+++ libwnck-2.30.0/libwnck/Makefile.am	2010-04-03 21:08:33.899401342 +0100
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3239
@@ -27,6 +27,11 @@
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3240
 wnck_built_headers = $(wnck_built_installed_headers) wnck-marshal.h
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3241
 wnck_built_cfiles = wnck-enum-types.c wnck-marshal.c
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3242
 
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3243
+wncktsol_sources =              \
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3244
+        wnck-tsol.c
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3245
+wncktsol_h_sources =            \
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3246
+        wnck-tsol.h
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3247
+
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3248
 # Sources that are relevant for introspection
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3249
 wnck_sources =			\
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3250
 	application.c		\
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3251
@@ -58,6 +63,11 @@
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3252
 	private.h		\
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3253
 	xutils.c		\
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3254
 	xutils.h		\
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3255
+        tsol-pics.h             \
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3256
+        trusted-tooltips.c      \
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3257
+        trusted-tooltips.h      \
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3258
+        $(wncktsol_sources)             \
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3259
+        $(wncktsol_h_sources)   \
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3260
 	$(wnck_accessibility_files)
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3261
 
208207fdc93f 2010-04-03 Christian Kelly <[email protected]>
chrisk
parents: 16055
diff changeset
  3262
 $(libwnck_1_la_OBJECTS): $(wnck_built_headers) inlinepixbufs.h