Skip to content

Commit 25069e3

Browse files
committed
Try to fix styles
1 parent 80affd6 commit 25069e3

1 file changed

Lines changed: 22 additions & 16 deletions

File tree

‎plugins/pip/SelectionArea.vala‎

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,7 @@ public class Gala.Plugins.PIP.SelectionArea : CanvasActor {
9393

9494
var confirm_button_pixbuf = Gala.Utils.get_confirm_button_pixbuf (CONFIRM_BUTTON_SIZE);
9595
if (confirm_button_pixbuf != null) {
96-
confirm_button_img = new Cairo.ImageSurface (Cairo.Format.ARGB32, CONFIRM_BUTTON_SIZE, CONFIRM_BUTTON_SIZE);
97-
Cairo.Context img_ctx = new Cairo.Context (confirm_button_img);
98-
99-
Gdk.cairo_set_source_pixbuf (img_ctx, confirm_button_pixbuf, 0, 0);
100-
img_ctx.rectangle (0.0, 0.0, CONFIRM_BUTTON_SIZE, CONFIRM_BUTTON_SIZE);
101-
img_ctx.paint ();
96+
confirm_button_img = new Cairo.ImageSurface.for_data (confirm_button_pixbuf.get_pixels (), Cairo.Format.ARGB32, CONFIRM_BUTTON_SIZE, CONFIRM_BUTTON_SIZE, confirm_button_pixbuf.rowstride);
10297
}
10398
}
10499

@@ -315,33 +310,40 @@ public class Gala.Plugins.PIP.SelectionArea : CanvasActor {
315310
// Draws a full-screen colored rectangle with a smaller transparent
316311
// rectangle inside with border with handlers
317312
ctx.save ();
318-
319313
ctx.set_operator (Cairo.Operator.CLEAR);
320314
ctx.paint ();
321-
322315
ctx.restore ();
323316

324317
// if (!dragging) {
325318
// return;
326319
// }
327320

328-
ctx.set_operator (Cairo.Operator.SOURCE);
329-
321+
330322
// Full-screen rectangle
323+
ctx.save ();
324+
ctx.set_operator (Cairo.Operator.OVER);
331325
ctx.rectangle (0, 0, width, height);
332-
ctx.set_source_rgba (0.0, 0.0, 0.0, 0.0);
326+
ctx.set_source_rgba (0.0, 0.0, 0.0, 0.5);
333327
ctx.fill ();
328+
ctx.restore ();
334329

335330
// Transparent rectangle
336331
int x, y, w, h;
337332
get_selection_rectangle (out x, out y, out w, out h);
338333

334+
ctx.save ();
335+
ctx.set_operator (Cairo.Operator.SOURCE);
339336
ctx.rectangle (x, y, w, h);
340-
ctx.set_source_rgba (0.1, 0.1, 0.1, 0.2);
337+
ctx.set_source_rgba (0.0, 0.0, 0.0, 0.0);
341338
ctx.fill ();
339+
ctx.restore ();
340+
341+
ctx.save ();
342342

343+
// Border
344+
ctx.set_operator (Cairo.Operator.OVER);
343345
ctx.rectangle (x, y, w, h);
344-
ctx.set_source_rgb (0.7, 0.7, 0.7);
346+
ctx.set_source_rgba (0.7, 0.7, 0.7, 0.7);
345347
ctx.set_line_width (1.0);
346348
ctx.stroke ();
347349

@@ -355,18 +357,22 @@ public class Gala.Plugins.PIP.SelectionArea : CanvasActor {
355357
ctx.arc (end_point.x, end_point.y, HANDLER_RADIUS, 0.0, 2.0 * Math.PI);
356358
ctx.fill ();
357359

360+
ctx.restore ();
361+
362+
358363
// Confirm button
359364
if (confirm_button_img != null) {
360365
var img_x = ((start_point.x + end_point.x) / 2) - (CONFIRM_BUTTON_SIZE / 2);
361366
var img_y = ((start_point.y + end_point.y) / 2) - (CONFIRM_BUTTON_SIZE / 2);
362367

368+
ctx.save ();
369+
ctx.set_operator (Cairo.Operator.SOURCE);
363370
ctx.set_source_surface (confirm_button_img, img_x, img_y);
364371
ctx.rectangle (img_x, img_y, CONFIRM_BUTTON_SIZE, CONFIRM_BUTTON_SIZE);
365372
ctx.clip ();
366373
ctx.paint ();
374+
ctx.fill ();
375+
ctx.restore ();
367376
}
368-
369-
// Hide the masked part of the actor
370-
clone.set_clip (start_point.x - clone.x, start_point.y - clone.y, w, h);
371377
}
372378
}

0 commit comments

Comments
 (0)