~hikiko/compiz/compiz.fix-build

« back to all changes in this revision

Viewing changes to gtk/window-decorator/decorator.c

  • Committer: Bileto Bot
  • Author(s): Alberts Muktupāvels
  • Date: 2016-06-02 01:29:12 UTC
  • mfrom: (4044.2.4 gwd-remove-2d)
  • Revision ID: ci-train-bot@canonical.com-20160602012912-pscipqlbwa43uuij
gtk-window-decorator: remove broken 2D decoration mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
241
241
                gwd_theme_get_event_window_position (gwd_theme, d, i, j, width, height,
242
242
                                                     &x, &y, &w, &h);
243
243
 
244
 
            /* Reparenting mode - create boxes which we monitor motionnotify on */
245
 
            if (d->frame_window)
246
 
            {
247
 
                BoxPtr box = &d->event_windows[i][j].pos;
248
 
                box->x1  = x;
249
 
                box->x2 = x + w;
250
 
                box->y1 = y;
251
 
                box->y2 = y + h;
252
 
            }
253
244
            /* Pixmap mode with window geometry - create small event windows */
254
 
            else if (!d->frame_window && w != 0 && h != 0)
 
245
            if (w != 0 && h != 0)
255
246
            {
256
247
                XMapWindow (xdisplay, d->event_windows[i][j].window);
257
248
                XMoveResizeWindow (xdisplay, d->event_windows[i][j].window,
258
249
                                   x, y, w, h);
259
250
            }
260
251
            /* No parent and no geometry - unmap all event windows */
261
 
            else if (!d->frame_window)
 
252
            else
262
253
            {
263
254
                XUnmapWindow (xdisplay, d->event_windows[i][j].window);
264
255
            }
285
276
            WNCK_WINDOW_ACTION_UNSTICK
286
277
        };
287
278
 
288
 
        /* Reparenting mode - if a box was set and we no longer need it reset its geometry */
289
 
        if (d->frame_window &&
290
 
            button_actions[i] && !(actions & button_actions[i]))
291
 
        {
292
 
            memset (&d->button_windows[i].pos, 0, sizeof (Box));
293
 
        }
294
279
        /* Pixmap mode - if a box was set and we no longer need it unmap its window */
295
 
        else if (!d->frame_window &&
296
 
                 button_actions[i] && !(actions & button_actions[i]))
 
280
        if (button_actions[i] && !(actions & button_actions[i]))
297
281
        {
298
282
            XUnmapWindow (xdisplay, d->button_windows[i].window);
299
283
            continue;
300
284
        }
301
285
 
302
 
        /* Reparenting mode - if there is a button position for this
303
 
         * button then set the geometry */
304
 
        if (d->frame_window &&
305
 
            gwd_theme_get_button_position (gwd_theme, d, i, width, height,
306
 
                                           &x, &y, &w, &h))
307
 
        {
308
 
            BoxPtr box = &d->button_windows[i].pos;
309
 
            box->x1 = x;
310
 
            box->y1 = y;
311
 
            box->x2 = x + w;
312
 
            box->y2 = y + h;
313
 
        }
314
286
        /* Pixmap mode - if there is a button position for this button then map the window
315
287
         * and resize it to this position */
316
 
        else if (!d->frame_window &&
317
 
                 gwd_theme_get_button_position (gwd_theme, d, i, width, height,
318
 
                                                &x, &y, &w, &h))
 
288
        if (gwd_theme_get_button_position (gwd_theme, d, i, width, height,
 
289
                                           &x, &y, &w, &h))
319
290
        {
320
291
            Window x11_win = d->button_windows[i].window;
321
292
            XMapWindow (xdisplay, x11_win);
322
293
            XMoveResizeWindow (xdisplay, x11_win, x, y, w, h);
323
294
        }
324
 
        else if (!d->frame_window)
 
295
        else
325
296
        {
326
297
            XUnmapWindow (xdisplay, d->button_windows[i].window);
327
298
        }
462
433
    }
463
434
}
464
435
 
 
436
static cairo_surface_t *
 
437
surface_new_from_pixbuf (GdkPixbuf *pixbuf,
 
438
                         GtkWidget *parent)
 
439
{
 
440
    guint width;
 
441
    guint height;
 
442
    cairo_surface_t *surface;
 
443
    cairo_t *cr;
 
444
 
 
445
    width  = gdk_pixbuf_get_width (pixbuf);
 
446
    height = gdk_pixbuf_get_height (pixbuf);
 
447
 
 
448
    surface = create_surface (width, height, parent);
 
449
    if (!surface)
 
450
        return NULL;
 
451
 
 
452
    cr = cairo_create (surface);
 
453
    gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
 
454
    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
 
455
    cairo_paint (cr);
 
456
    cairo_destroy (cr);
 
457
 
 
458
    return surface;
 
459
}
 
460
 
465
461
/*
466
462
 * update_window_decoration_icon
467
463
 *
497
493
 
498
494
        g_object_ref (G_OBJECT (d->icon_pixbuf));
499
495
 
500
 
        /* 32 bit pixmap on pixmap mode, 24 for reparenting */
501
 
        if (d->frame_window)
502
 
            d->icon_surface = surface_new_from_pixbuf (d->icon_pixbuf,
503
 
                                                       d->frame->style_window_rgb);
504
 
        else
505
 
            d->icon_surface = surface_new_from_pixbuf (d->icon_pixbuf,
506
 
                                                       d->frame->style_window_rgba);
 
496
        d->icon_surface = surface_new_from_pixbuf (d->icon_pixbuf,
 
497
                                                   d->frame->style_window_rgba);
 
498
 
507
499
        cr = cairo_create (d->icon_surface);
508
500
        d->icon = cairo_pattern_create_for_surface (cairo_get_target (cr));
509
501
        cairo_destroy (cr);
515
507
 * Description: asks the rendering process to allow a size update
516
508
 * for pixmap synchronization */
517
509
 
518
 
 
519
510
gboolean
520
511
request_update_window_decoration_size (WnckWindow *win)
521
512
{
574
565
    cairo_surface_t   *surface, *buffer_surface = NULL;
575
566
    Picture           picture;
576
567
    Display           *xdisplay;
577
 
    XRenderPictFormat *format;
578
568
 
579
569
    if (win == NULL)
580
570
        return FALSE;
588
578
 
589
579
    gdk_error_trap_push ();
590
580
 
591
 
    /* Get the correct depth for the frame window in reparenting mode, otherwise
592
 
     * enforce 32 */
593
 
    if (d->frame_window)
594
 
        surface = create_native_surface_and_wrap (d->width, d->height, d->frame->style_window_rgb);
595
 
    else
596
 
        surface = create_native_surface_and_wrap (d->width, d->height, d->frame->style_window_rgba);
 
581
    surface = create_native_surface_and_wrap (d->width, d->height, d->frame->style_window_rgba);
597
582
 
598
583
    gdk_flush ();
599
584
 
607
592
 
608
593
    gdk_error_trap_push ();
609
594
 
610
 
    if (d->frame_window)
611
 
        buffer_surface = create_surface (d->width, d->height, d->frame->style_window_rgb);
612
 
    else
613
 
        buffer_surface = create_surface (d->width, d->height, d->frame->style_window_rgba);
 
595
    buffer_surface = create_surface (d->width, d->height, d->frame->style_window_rgba);
614
596
 
615
597
    gdk_flush ();
616
598
 
624
606
    }
625
607
 
626
608
    /* Create XRender context */
627
 
    format = get_format_for_surface (d, buffer_surface);
628
609
    picture = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (buffer_surface),
629
 
                                    format, 0, NULL);
 
610
                                    xformat_rgba, 0, NULL);
630
611
 
631
612
    /* Destroy the old pixmaps and pictures */
632
613
    if (d->surface)
1439
1420
    frame->win_extents = _shadow_extents;
1440
1421
    frame->window_context_active = _shadow_context;
1441
1422
    frame->window_context_inactive = _shadow_context;
1442
 
    frame->window_context_no_shadow = _shadow_context;
1443
1423
    frame->max_window_context_active = _shadow_context;
1444
1424
    frame->max_window_context_inactive = _shadow_context;
1445
 
    frame->max_window_context_no_shadow = _shadow_context;
1446
1425
    frame->update_shadow = bare_frame_update_shadow;
1447
1426
 
1448
1427
    return frame;
1465
1444
        0, 0, 0, 0
1466
1445
    };
1467
1446
 
1468
 
    decor_context_t _window_context_no_shadow = {
1469
 
        { 0, 0, 0, 0 },
1470
 
        6, 6, 4, 6,
1471
 
        0, 0, 0, 0
1472
 
    };
1473
 
 
1474
 
    decor_context_t _max_window_context_no_shadow = {
1475
 
        { 0, 0, 0, 0 },
1476
 
        6, 6, 4, 6,
1477
 
        0, 0, 0, 0
1478
 
    };
1479
 
 
1480
1447
    decor_extents_t _win_extents         = { 6, 6, 6, 6 };
1481
1448
    decor_extents_t _max_win_extents     = { 6, 6, 4, 6 };
1482
1449
 
1485
1452
    frame->update_shadow = decor_frame_update_shadow;
1486
1453
    frame->window_context_active = _window_context;
1487
1454
    frame->window_context_inactive = _window_context;
1488
 
    frame->window_context_no_shadow = _window_context_no_shadow;
1489
1455
    frame->max_window_context_active = _max_window_context;
1490
1456
    frame->max_window_context_inactive = _max_window_context;
1491
 
    frame->max_window_context_no_shadow = _max_window_context_no_shadow;
1492
1457
 
1493
1458
    return frame;
1494
1459
}