~noskcaj/ubuntu/trusty/xfdesktop4/merge

« back to all changes in this revision

Viewing changes to src/xfce-desktop.c

  • Committer: Package Import Robot
  • Author(s): Lionel Le Folgoc
  • Date: 2012-01-09 19:22:54 UTC
  • Revision ID: package-import@ubuntu.com-20120109192254-6m84ewh01sb82gdc
Tags: 4.8.3-1ubuntu4
* debian/patches:
  - xubuntu_avoid-multiple-instances.patch: updated, and simplified.
  - xubuntu_improve-nautilus-interactions.patch: added, should prevent
    nautilus from taking over the desktop if xfdesktop is running.

Show diffs side-by-side

added added

removed removed

Lines of Context:
472
472
static void
473
473
screen_set_selection(XfceDesktop *desktop)
474
474
{
475
 
    Window xwin, xid;
 
475
    Window xwin;
476
476
    gint xscreen;
477
 
    gchar selection_name[100];
478
 
    Atom selection_atom, manager_atom;
 
477
    gchar selection_name[100], common_selection_name[32];
 
478
    Atom selection_atom, common_selection_atom, manager_atom;
479
479
    
480
480
    xwin = GDK_WINDOW_XID(GTK_WIDGET(desktop)->window);
481
481
    xscreen = gdk_screen_get_number(desktop->priv->gscreen);
484
484
    selection_atom = XInternAtom(GDK_DISPLAY(), selection_name, False);
485
485
    manager_atom = XInternAtom(GDK_DISPLAY(), "MANAGER", False);
486
486
 
487
 
    if(xfdesktop_check_is_running(&xid)) {
488
 
        /* the previous check in src/main.c occurs too early, so workaround by
489
 
         * adding this one. Hopefully it should help for lp #329616 */
 
487
    g_snprintf(common_selection_name, 32, "_NET_DESKTOP_MANAGER_S%d", xscreen);
 
488
    common_selection_atom = XInternAtom(GDK_DISPLAY(), common_selection_name, False);
 
489
 
 
490
    /* the previous check in src/main.c occurs too early, so workaround by
 
491
     * adding this one. Hopefully it should help for lp #329616 */
 
492
    if(XGetSelectionOwner(GDK_DISPLAY(), selection_atom) != None) {
490
493
        g_warning("%s: already running, quitting.", PACKAGE);
491
494
        exit(0);
492
495
    }
493
496
 
 
497
    /* Check that _NET_DESKTOP_MANAGER_S%d isn't set, as it means another
 
498
     * desktop manager is running, e.g. nautilus */
 
499
    if(XGetSelectionOwner (GDK_DISPLAY(), common_selection_atom) != None) {
 
500
        g_warning("%s: another desktop manager is running.", PACKAGE);
 
501
        exit(1);
 
502
    }
 
503
 
494
504
    XSelectInput(GDK_DISPLAY(), xwin, PropertyChangeMask | ButtonPressMask);
495
505
    XSetSelectionOwner(GDK_DISPLAY(), selection_atom, xwin, GDK_CURRENT_TIME);
 
506
    XSetSelectionOwner(GDK_DISPLAY(), common_selection_atom, xwin, GDK_CURRENT_TIME);
496
507
 
497
508
    /* Check to see if we managed to claim the selection. If not,
498
509
     * we treat it as if we got it then immediately lost it */