~ubuntu-branches/ubuntu/oneiric/gnome-panel/oneiric

« back to all changes in this revision

Viewing changes to gnome-panel/xstuff.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher, Sebastien Bacher, Jeremy Bicha
  • Date: 2011-05-30 11:04:49 UTC
  • mfrom: (1.13.10 upstream) (2.2.5 experimental)
  • Revision ID: james.westby@ubuntu.com-20110530110449-hinl17kxkcefjw6x
Tags: 1:3.0.2-0ubuntu1
[ Sebastien Bacher ]
* New upstream version
* debian/control.in:
  - the new libgweather version is in oneiric, use it
  - drop the python and python-gconf depends, 
    they were added for gnome-panel-add which is still using gconf and buggy
* debian/gnome-panel-data.install:
  - don't install the apport hook, it's only getting gconf datas which 
    doesn't work since gnome-panel uses gsettings
* debian/patches/90_build_fixes.patch:
  - restore build fix from git not applied in the new serie
* debian/patches/01_panel_submenus.patch:
  - don't take that Debian diff, the .menus use the upstream naming in Ubuntu
* debian/patches/06_no_resize_grip.patch:
  - dropped, the issue is fixed in the new version
* debian/patches/50_fix-potfiles.patch:
  - dropped, the issue is fixed in the new version
* debian/watch:
  - track unstable series as well

Drop those delta, since gnome-panel is not the default Ubuntu session now we
can go back to an experience closer to the upstream one: 
* debian/control.in:
  - drop the indicators recommends, unity-2d is the ubuntu fallback session
    so we can get back to use an upstream config for gnome-panel and reduce
    the delta we carry
* debian/patches/04_default_panel_config.patch:
  - don't modify the upstream layout
* debian/patches/05_no_session_delay.patch:
  - no need to tweak the upstream session to optimize it
* debian/patches/16_compiz_workspace_switcher.patch:
  - go back to the upstream switcher behaviour    
* debian/patches/25_dynamic_fusa_detection.patch:
  - not needed since we use the upstream layout, could be ported if someone
    is wanting to do the work though
* debian/patches/30_disable-initial-animation.patch, debian/rules:
  - drop the --disable-initial-animation, that was some login optimization
    but since it's not the default desktop you should go back to the 
    upstream behaviour

[ Jeremy Bicha ]   
* New upstream version
* Merge from Debian experimental, remaining Ubuntu changes:
* debian/control:
  - Recommends gnome-settings-daemon which has the timezone polkit service
* debian/rules:
  - Update translations template.
* debian/gnome-panel-data.install:
  - Install apport hook
  - Install the "About Ubuntu" menu item.
* debian/patches/01_layout.patch:
  - Disabled, Help & About Ubuntu don't fit as well in Gnome Panel 3
* debian/patches/01_panel_submenus.patch.
  - Dropped
* debian/patches/03_dnd_places_link.patch:
  - Disabled, when using Drag'n'Drop from Places menu, install a link launcher
    (.desktop file) instead of copying the entire directory.
* debian/patches/17_about-ubuntu-translation.patch:
  - List ubuntu-about.desktop for translation.
* debian/patches/40_unset_menuproxy.patch:
  - Make sure gnome-panel and the applets don't pick up menu proxies.
* debian/patches/50_fix-potfiles.patch
  - Fix i18n
* debian/patches/85_disable_shutdown_on_ltsp.patch:
  - Suppress the shutdown option in the panel if LTSP_CLIENT is set.
* debian/patches/71_change_bookmark_submenu_limit_value.patch
  - Dropped, picked up by Debian
* debian/patches/18_lockdown_lock_editor.patch:
* debian/patches/90_git_wnck_show_realize.patch:
* debian/patches/90_fix_linking_DSO_link.patch:
* debian/patches/91_gir_annotations.patch
* debian/patches/92_git_calendar_day.patch
* debian/patches/92_git_fix_applets_in_multiscreen.patch:
  - Dropped, applied upstream
* debian/watch:
  - watch unstable versions

Show diffs side-by-side

added added

removed removed

Lines of Context:
163
163
        int       size;
164
164
 
165
165
        xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
166
 
        root_window = GDK_WINDOW_XWINDOW (
167
 
                                gdk_get_default_root_window ());
 
166
        root_window = GDK_WINDOW_XID (gdk_get_default_root_window ());
168
167
 
169
168
        /* FIXME this is totally broken; should be using
170
169
         * gdk_net_wm_supports() on particular hints when we rely
183
182
        return TRUE;
184
183
}
185
184
 
186
 
gboolean
187
 
xstuff_net_wm_supports (const char *hint)
188
 
{
189
 
        return gdk_net_wm_supports (gdk_atom_intern (hint, FALSE));
190
 
}
191
 
 
192
185
/* This is such a broken stupid function. */   
193
186
void
194
187
xstuff_set_pos_size (GdkWindow *window, int x, int y, int w, int h)
218
211
        gdk_error_trap_push ();
219
212
 
220
213
        XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window),
221
 
                           GDK_WINDOW_XWINDOW (window),
 
214
                           GDK_WINDOW_XID (window),
222
215
                           &size_hints);
223
216
 
224
217
        gdk_window_move_resize (window, x, y, w, h);
225
218
 
226
 
        gdk_flush ();
227
 
        gdk_error_trap_pop ();
 
219
        gdk_error_trap_pop_ignored ();
228
220
 
229
221
        g_object_set_data (G_OBJECT (window), "xstuff-cached-x", GINT_TO_POINTER (x));
230
222
        g_object_set_data (G_OBJECT (window), "xstuff-cached-y", GINT_TO_POINTER (y));
246
238
        }
247
239
 
248
240
        XChangeProperty (GDK_WINDOW_XDISPLAY (window),
249
 
                         GDK_WINDOW_XWINDOW (window),
 
241
                         GDK_WINDOW_XID (window),
250
242
                         panel_atom_get ("_NET_WM_WINDOW_TYPE"),
251
243
                         XA_ATOM, 32, PropModeReplace,
252
244
                         (unsigned char *) atoms, 
268
260
        vals [3] = bottom;
269
261
 
270
262
        XChangeProperty (GDK_WINDOW_XDISPLAY (window),
271
 
                         GDK_WINDOW_XWINDOW (window),
 
263
                         GDK_WINDOW_XID (window),
272
264
                         panel_atom_get ("_NET_WM_STRUT"),
273
265
                         XA_CARDINAL, 32, PropModeReplace,
274
266
                         (unsigned char *) vals, 4);
278
270
xstuff_delete_property (GdkWindow *window, const char *name)
279
271
{
280
272
        Display *xdisplay = GDK_WINDOW_XDISPLAY (window);
281
 
        Window   xwindow  = GDK_WINDOW_XWINDOW (window);
 
273
        Window   xwindow  = GDK_WINDOW_XID (window);
282
274
 
283
275
        XDeleteProperty (xdisplay, xwindow,
284
276
                         panel_atom_get (name));
313
305
}
314
306
 
315
307
static gboolean
316
 
zoom_expose (GtkWidget      *widget,
317
 
             GdkEventExpose *event,
318
 
             gpointer        user_data)
 
308
idle_destroy (gpointer data)
 
309
{
 
310
        gtk_widget_destroy (GTK_WIDGET (data));
 
311
 
 
312
        return FALSE;
 
313
}
 
314
 
 
315
static gboolean
 
316
zoom_draw (GtkWidget *widget,
 
317
           cairo_t   *cr,
 
318
           gpointer    user_data)
319
319
{
320
320
        CompositedZoomData *zoom;
321
321
 
331
331
 
332
332
                g_slice_free (CompositedZoomData, zoom);
333
333
 
334
 
                gtk_widget_destroy (widget);
 
334
                g_idle_add (idle_destroy, widget);
335
335
        } else {
336
336
                GdkPixbuf *scaled;
337
337
                int width, height;
338
338
                int x = 0, y = 0;
339
 
                cairo_t *cr;
340
339
 
341
340
                gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
342
341
 
370
369
                }
371
370
 
372
371
 
373
 
                cr = gdk_cairo_create (gtk_widget_get_window (widget));
374
372
                cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
375
373
                cairo_set_source_rgba (cr, 0, 0, 0, 0.0);
376
374
                cairo_rectangle (cr, 0, 0, width, height);
380
378
                cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
381
379
                cairo_paint_with_alpha (cr, MAX (zoom->opacity, 0));
382
380
 
383
 
                cairo_destroy (cr);
384
381
                g_object_unref (scaled);
385
382
        }
386
383
 
415
412
        gtk_window_set_keep_above (GTK_WINDOW (win), TRUE);
416
413
        gtk_window_set_decorated (GTK_WINDOW (win), FALSE);
417
414
        gtk_widget_set_app_paintable(win, TRUE);
418
 
        gtk_widget_set_colormap (win, gdk_screen_get_rgba_colormap (gscreen));
 
415
        gtk_widget_set_visual (win, gdk_screen_get_rgba_visual (gscreen));
419
416
 
420
417
        gtk_window_set_gravity (GTK_WINDOW (win), GDK_GRAVITY_STATIC);
421
418
        gtk_window_set_default_size (GTK_WINDOW (win),
445
442
 
446
443
        gtk_window_move (GTK_WINDOW (win), wx, wy);
447
444
 
448
 
        g_signal_connect (G_OBJECT (win), "expose-event",
449
 
                          G_CALLBACK (zoom_expose), zoom);
 
445
        g_signal_connect (G_OBJECT (win), "draw",
 
446
                          G_CALLBACK (zoom_draw), zoom);
450
447
 
451
448
        /* see doc for gtk_widget_set_app_paintable() */
452
449
        gtk_widget_realize (win);
453
 
        gdk_window_set_back_pixmap (gtk_widget_get_window (win), NULL, FALSE);
 
450
        gdk_window_set_background_pattern (gtk_widget_get_window (win), NULL);
454
451
        gtk_widget_show (win);
455
452
 
456
453
        zoom->timeout_id = g_timeout_add (ZOOM_DELAY,
475
472
        Display *dpy;
476
473
        Window root_win;
477
474
        int screen;
478
 
        int depth;
479
475
 
480
476
        dpy = gdk_x11_display_get_xdisplay (gdk_screen_get_display (gscreen));
481
 
        root_win = gdk_x11_drawable_get_xid (gdk_screen_get_root_window (gscreen));
 
477
        root_win = GDK_WINDOW_XID (gdk_screen_get_root_window (gscreen));
482
478
        screen = gdk_screen_get_number (gscreen);
483
 
        depth = gdk_drawable_get_depth (gdk_screen_get_root_window (gscreen));
484
479
 
485
480
        /* frame GC */
486
 
        gdk_colormap_alloc_color (
487
 
                gdk_screen_get_system_colormap (gscreen), &color, FALSE, TRUE);
488
481
        gcv.function = GXxor;
489
482
        /* this will raise the probability of the XORed color being different
490
483
         * of the original color in PseudoColor when not all color cells are
491
484
         * initialized */
492
 
        if (DefaultVisual(dpy, screen)->class==PseudoColor)
 
485
        if (DefaultVisual(dpy, screen)->class==PseudoColor) {
 
486
                int depth = DefaultDepth (dpy, screen);
493
487
                gcv.plane_mask = (1<<(depth-1))|1;
494
 
        else
 
488
        } else
495
489
                gcv.plane_mask = AllPlanes;
496
490
        gcv.foreground = color.pixel;
497
491
        if (gcv.foreground == 0)
575
569
 
576
570
        XUngrabServer(dpy);
577
571
        XFreeGC (dpy, frame_gc);
578
 
        gdk_colormap_free_colors (gdk_screen_get_system_colormap (gscreen),
579
 
                                  &color, 1);
580
 
 
581
572
}
582
573
#undef FRAMES
583
574
 
639
630
        int     result;
640
631
        int     retval;
641
632
 
642
 
        root_window = gdk_x11_drawable_get_xid (
643
 
                                gdk_screen_get_root_window (screen));
 
633
        root_window = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
644
634
 
645
635
        gdk_error_trap_push ();
646
636
        result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen)),
685
675
                if (grab)
686
676
                        XGrabKey (gdk_x11_display_get_xdisplay (display),
687
677
                                  keycode, modifiers,
688
 
                                  gdk_x11_drawable_get_xid (root),
 
678
                                  GDK_WINDOW_XID (root),
689
679
                                  True, GrabModeAsync, GrabModeAsync);
690
680
                else
691
681
                        XUngrabKey (gdk_x11_display_get_xdisplay (display),
692
682
                                    keycode, modifiers,
693
 
                                    gdk_x11_drawable_get_xid (root));
 
683
                                    GDK_WINDOW_XID (root));
694
684
        }
695
685
}
696
686