~ubuntu-branches/ubuntu/precise/xfwm4/precise-updates

« back to all changes in this revision

Viewing changes to src/tabwin.c

  • Committer: Bazaar Package Importer
  • Author(s): Jérôme Guelfucci, Jérôme Guelfucci, Lionel Le Folgoc
  • Date: 2009-01-30 18:28:59 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20090130182859-1tci3n1f1hhppvc2
Tags: 4.5.99.1-0ubuntu1
[ Jérôme Guelfucci ]
* Merge with Debian Xfce UNRELEASED, remaining Ubuntu changes:
  - debian/xfwm4.1: update bug reporting address (LP instead of Debian BTS).

[ Lionel Le Folgoc ]
* debian/control: use our Vcs-* fields.
* Bugs fixed by this new release:
  - "User interface of focused application is covered by another application's
    new window in Xfce" (LP: #250101)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*      $Id: tabwin.c 23330 2006-10-09 20:21:48Z olivier $
 
1
/*      $Id$
2
2
 
3
3
        This program is free software; you can redistribute it and/or modify
4
4
        it under the terms of the GNU General Public License as published by
12
12
 
13
13
        You should have received a copy of the GNU General Public License
14
14
        along with this program; if not, write to the Free Software
15
 
        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
 
 
17
 
        xfwm4    - (c) 2002-2006 Olivier Fourdan
 
15
        Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston,
 
16
        MA 02110-1301, USA.
 
17
 
 
18
 
 
19
        xfwm4    - (c) 2002-2009 Olivier Fourdan
18
20
 
19
21
 */
20
22
 
21
23
#ifdef HAVE_CONFIG_H
22
 
#include <config.h>
 
24
#include "config.h"
23
25
#endif
24
26
 
25
27
#ifndef WIN_ICON_SIZE
65
67
static gboolean
66
68
paint_selected (GtkWidget * w, GdkEventExpose * event, gpointer data)
67
69
{
68
 
    gtk_paint_box (w->style, w->window,
 
70
    gtk_draw_flat_box (w->style, w->window,
69
71
        GTK_STATE_SELECTED,
70
 
        GTK_SHADOW_IN,
71
 
        NULL, w, "box",
 
72
        GTK_SHADOW_NONE,
 
73
        w->allocation.x - WIN_ICON_BORDER,
 
74
        w->allocation.y - WIN_ICON_BORDER,
 
75
        w->allocation.width + 2 * WIN_ICON_BORDER,
 
76
        w->allocation.height + 2 * WIN_ICON_BORDER);
 
77
    gtk_draw_focus (w->style, w->window,
72
78
        w->allocation.x - WIN_ICON_BORDER,
73
79
        w->allocation.y - WIN_ICON_BORDER,
74
80
        w->allocation.width + 2 * WIN_ICON_BORDER,
84
90
 
85
91
    if (s)
86
92
    {
87
 
        canonical = g_strdup (s);
88
 
        g_strcanon (canonical, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", ' ');
 
93
        canonical = g_ascii_strup (s, -1);
 
94
        g_strcanon (canonical, "[]()0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", ' ');
89
95
        g_strstrip (canonical);
90
 
        *canonical = g_ascii_toupper (*canonical);
91
96
    }
92
97
    else
93
98
    {
127
132
tabwinSetSelected (Tabwin * t, GtkWidget * w)
128
133
{
129
134
    Client *c;
 
135
    gchar *classname;
130
136
 
131
137
    if (t->selected_callback)
132
138
    {
135
141
    t->selected_callback = g_signal_connect (G_OBJECT (w), "expose-event", G_CALLBACK (paint_selected), NULL);
136
142
    c = g_object_get_data (G_OBJECT (w), "client-ptr-val");
137
143
 
138
 
    tabwinSetLabel (t, c->class.res_class, c->name, c->win_workspace);
 
144
    if (FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED))
 
145
    {
 
146
        classname = g_strdup_printf ("[ %s ]", c->class.res_class);
 
147
    }
 
148
    else
 
149
    {
 
150
        classname = g_strdup(c->class.res_class);
 
151
    }
 
152
    tabwinSetLabel (t, classname, c->name, c->win_workspace);
 
153
    g_free (classname);
139
154
}
140
155
 
141
156
static GtkWidget *
142
157
createWindowIcon (Client * c)
143
158
{
144
159
    GdkPixbuf *icon_pixbuf;
 
160
    GdkPixbuf *icon_pixbuf_stated;
145
161
    GtkWidget *icon;
146
162
 
147
163
    icon_pixbuf = getAppIcon (c->screen_info->display_info, c->window, WIN_ICON_SIZE, WIN_ICON_SIZE);
 
164
    icon_pixbuf_stated = NULL;
148
165
    icon = gtk_image_new ();
149
166
    g_object_set_data (G_OBJECT (icon), "client-ptr-val", c);
150
167
 
151
168
    if (icon_pixbuf)
152
169
    {
153
 
        gtk_image_set_from_pixbuf (GTK_IMAGE (icon), icon_pixbuf);
 
170
        if (FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED))
 
171
        {
 
172
            icon_pixbuf_stated = gdk_pixbuf_copy (icon_pixbuf);
 
173
            gdk_pixbuf_saturate_and_pixelate (icon_pixbuf, icon_pixbuf_stated, 0.25, TRUE);
 
174
            gtk_image_set_from_pixbuf (GTK_IMAGE (icon), icon_pixbuf_stated);
 
175
            g_object_unref(icon_pixbuf_stated);
 
176
        }
 
177
        else
 
178
        {
 
179
            gtk_image_set_from_pixbuf (GTK_IMAGE (icon), icon_pixbuf);
 
180
        }
154
181
        g_object_unref(icon_pixbuf);
155
182
    }
156
183
    else
174
201
    unsigned int grid_rows;
175
202
    int i, packpos;
176
203
    int msx, msy;
177
 
    gint monitor;
178
204
 
179
205
    g_return_val_if_fail (current != NULL, NULL);
180
206
 
190
216
    g_return_val_if_fail (n_clients > 0, NULL);
191
217
 
192
218
    getMouseXY (screen_info, screen_info->xroot, &msx, &msy);
193
 
    monitor = find_monitor_at_point (scr, msx, msy);
194
 
    gdk_screen_get_monitor_geometry (scr, monitor, &monitor_sz);
 
219
    myScreenFindMonitorAtPoint (screen_info, msx, msy, &monitor_sz);
195
220
 
196
221
    /* add the width of the border on each side */
197
222
    grid_cols = (monitor_sz.width / (WIN_ICON_SIZE + 2 * WIN_ICON_BORDER)) * 0.75;