From dd089f1b7aaa585486202c2b8dcdf49a927340d5 Mon Sep 17 00:00:00 2001 From: Aleksey Samoilov Date: Sun, 8 Feb 2026 21:08:44 +0400 Subject: [PATCH 1/3] Adapt to new alocation API --- .gitignore | 1 + .../applets/calendar@cinnamon.org/calendar.js | 4 +- .../appGroup.js | 16 +- .../window-list@cinnamon.org/applet.js | 10 +- js/ui/appSwitcher/classicSwitcher.js | 22 +- js/ui/boxpointer.js | 8 +- js/ui/checkBox.js | 60 ++-- js/ui/dnd.js | 4 +- js/ui/expoThumbnail.js | 12 +- js/ui/iconGrid.js | 18 +- js/ui/keyboardManager.js | 5 + js/ui/lookingGlass.js | 278 +++++++++--------- js/ui/panel.js | 18 +- js/ui/popupMenu.js | 10 +- js/ui/virtualKeyboard.js | 4 +- src/cinnamon-generic-container.c | 10 +- src/cinnamon-gtk-embed.c | 5 +- src/cinnamon-slicer.c | 7 +- src/cinnamon-stack.c | 7 +- src/st/st-bin.c | 8 +- src/st/st-entry.c | 15 +- src/st/st-label.c | 7 +- src/st/st-private.c | 3 +- src/st/st-scroll-bar.c | 19 +- src/st/st-scroll-view.c | 11 +- src/st/st-table.c | 21 +- src/st/st-texture-cache.c | 4 +- src/st/st-viewport.c | 7 +- src/st/st-widget.c | 8 +- tests/interactive/scroll-view-sizing.js | 10 +- 30 files changed, 296 insertions(+), 316 deletions(-) diff --git a/.gitignore b/.gitignore index b0cb671fde..94c0bd998a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ debian/files debian/tmp/ obj-x86_64-linux-gnu *.pyc +.cache diff --git a/files/usr/share/cinnamon/applets/calendar@cinnamon.org/calendar.js b/files/usr/share/cinnamon/applets/calendar@cinnamon.org/calendar.js index 05c9ddfed0..ea13507eef 100644 --- a/files/usr/share/cinnamon/applets/calendar@cinnamon.org/calendar.js +++ b/files/usr/share/cinnamon/applets/calendar@cinnamon.org/calendar.js @@ -526,7 +526,7 @@ class Calendar { } } - _allocate_dot_box (actor, box, flags) { + _allocate_dot_box (actor, box) { let children = actor.get_children(); if (children.length == 0) { @@ -567,7 +567,7 @@ class Calendar { cbox.y2 = cbox.y1 + nh; while (i < ((dot_row * max_children_per_row) + dots_this_row)) { - children[i].allocate(cbox, flags); + children[i].allocate(cbox); cbox.x1 += nw; cbox.x2 += nw; diff --git a/files/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org/appGroup.js b/files/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org/appGroup.js index 8ca0467b56..112b3ec3ea 100644 --- a/files/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org/appGroup.js +++ b/files/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org/appGroup.js @@ -404,7 +404,7 @@ class AppGroup { alloc.natural_size = Math.max(iconNaturalSize, labelNaturalSize); } - allocate(actor, box, flags) { + allocate(actor, box) { const allocWidth = box.x2 - box.x1; const allocHeight = box.y2 - box.y1; const childBox = new Clutter.ActorBox(); @@ -430,7 +430,7 @@ class AppGroup { [childBox.x1, childBox.x2] = center(allocWidth + offset, naturalWidth); } - this.iconBox.allocate(childBox, flags); + this.iconBox.allocate(childBox); // Set windows badge position const windowBadgeOffset = 3 * global.ui_scale; @@ -446,7 +446,7 @@ class AppGroup { const windowLabelPosY = Math.floor((windowBadgesize - wLabelNaturalHeight) / 2); this.windowsBadgeLabel.set_anchor_point(-windowLabelPosX, -windowLabelPosY); this.windowsBadge.set_size(windowBadgesize, windowBadgesize); - this.windowsBadge.allocate(windowBadgeBox, flags); + this.windowsBadge.allocate(windowBadgeBox); // Set notifications badge position const notifBadgeOffset = 3 * global.ui_scale; @@ -462,7 +462,7 @@ class AppGroup { const notifLabelPosY = Math.floor((notifBadgesize - nLabelNaturalHeight) / 2); this.notificationsBadgeLabel.set_anchor_point(-notifLabelPosX, -notifLabelPosY); this.notificationsBadge.set_size(notifBadgesize, notifBadgesize); - this.notificationsBadge.allocate(notifBadgeBox, flags); + this.notificationsBadge.allocate(notifBadgeBox); // Set label position if (this.drawLabel) { @@ -492,7 +492,7 @@ class AppGroup { else this.label.set_style('text-align: right;'); - this.label.allocate(childBox, flags); + this.label.allocate(childBox); } // Call set_icon_geometry for support of Cinnamon's minimize animation @@ -507,7 +507,7 @@ class AppGroup { }); } - if (this.progressOverlay.visible) this.allocateProgress(childBox, flags); + if (this.progressOverlay.visible) this.allocateProgress(childBox); } showLabel(animate = false) { @@ -610,7 +610,7 @@ class AppGroup { return total / count; } - allocateProgress(childBox = null, flags = 0) { + allocateProgress(childBox = null) { if (!childBox) childBox = new Clutter.ActorBox(); childBox.y1 = 0; childBox.y2 = this.actor.height; @@ -621,7 +621,7 @@ class AppGroup { childBox.x1 = 0; childBox.x2 = Math.max(this.actor.width * (this.progress / 100.0), 1.0); } - this.progressOverlay.allocate(childBox, flags); + this.progressOverlay.allocate(childBox); } onProgressChange(metaWindow) { diff --git a/files/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js index 86838228c1..51231df159 100644 --- a/files/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/window-list@cinnamon.org/applet.js @@ -717,7 +717,7 @@ class AppMenuButton { } } - _allocate(actor, box, flags) { + _allocate(actor, box) { let allocWidth = box.x2 - box.x1; let allocHeight = box.y2 - box.y1; @@ -750,7 +750,7 @@ class AppMenuButton { childBox.x1 = box.x1 + Math.floor(Math.max(0, allocWidth - naturalWidth) / 2); childBox.x2 = Math.min(childBox.x1 + naturalWidth, box.x2); } - this._iconBox.allocate(childBox, flags); + this._iconBox.allocate(childBox); // Set notifications badge position const notifBadgeOffset = 3 * global.ui_scale; @@ -766,7 +766,7 @@ class AppMenuButton { const notifLabelPosY = Math.floor((notifBadgesize - nLabelNaturalHeight) / 2); this.notificationsBadgeLabel.set_anchor_point(-notifLabelPosX, -notifLabelPosY); this.notificationsBadge.set_size(notifBadgesize, notifBadgesize); - this.notificationsBadge.allocate(notifBadgeBox, flags); + this.notificationsBadge.allocate(notifBadgeBox); if (this.drawLabel) { [minWidth, minHeight, naturalWidth, naturalHeight] = this._label.get_preferred_size(); @@ -783,7 +783,7 @@ class AppMenuButton { childBox.x1 = box.x1; } - this._label.allocate(childBox, flags); + this._label.allocate(childBox); } if (!this.progressOverlay.visible) { @@ -795,7 +795,7 @@ class AppMenuButton { childBox.x2 = this.actor.width; childBox.y2 = this.actor.height; - this.progressOverlay.allocate(childBox, flags); + this.progressOverlay.allocate(childBox); let clip_width = Math.max((this.actor.width) * (this._progress / 100.0), 1.0); this.progressOverlay.set_clip(0, 0, clip_width, this.actor.height); diff --git a/js/ui/appSwitcher/classicSwitcher.js b/js/ui/appSwitcher/classicSwitcher.js index 24651048ef..c939e8b29d 100644 --- a/js/ui/appSwitcher/classicSwitcher.js +++ b/js/ui/appSwitcher/classicSwitcher.js @@ -92,7 +92,7 @@ ClassicSwitcher.prototype = { alloc.natural_size = global.screen_height; }, - _allocate: function (actor, box, flags) { + _allocate: function (actor, box) { let childBox = new Clutter.ActorBox(); let monitor = this._activeMonitor; @@ -110,7 +110,7 @@ ClassicSwitcher.prototype = { childBox.x2 = Math.min(monitor.x + monitor.width - rightPadding, childBox.x1 + childNaturalWidth); childBox.y1 = monitor.y + Math.floor((monitor.height - childNaturalHeight) / 2); childBox.y2 = childBox.y1 + childNaturalHeight; - this._appList.actor.allocate(childBox, flags); + this._appList.actor.allocate(childBox); // Allocate the thumbnails // We try to avoid overflowing the screen so we base the resulting size on @@ -133,7 +133,7 @@ ClassicSwitcher.prototype = { this._thumbnails.addClones(monitor.y + monitor.height - bottomPadding - childBox.y1); let [childMinHeight, childNaturalHeight] = this._thumbnails.actor.get_preferred_height(-1); childBox.y2 = childBox.y1 + childNaturalHeight; - this._thumbnails.actor.allocate(childBox, flags); + this._thumbnails.actor.allocate(childBox); } }, @@ -518,7 +518,7 @@ SwitcherList.prototype = { this._activeMonitor = activeMonitor; }, - _allocateTop: function(actor, box, flags) { + _allocateTop: function(actor, box) { if (this._list.spacing === -1) { this._list.spacing = this._list.get_theme_node().get_length('spacing'); } @@ -529,20 +529,20 @@ SwitcherList.prototype = { let childBox = new Clutter.ActorBox(); let scrollable = this._minSize > box.x2 - box.x1; - this._clipBin.allocate(box, flags); + this._clipBin.allocate(box); childBox.x1 = 0; childBox.y1 = 0; childBox.x2 = this._leftGradient.width; childBox.y2 = this.actor.height; - this._leftGradient.allocate(childBox, flags); + this._leftGradient.allocate(childBox); this._leftGradient.opacity = (this._scrollableLeft && scrollable) ? 255 : 0; childBox.x1 = (this.actor.allocation.x2 - this.actor.allocation.x1) - this._rightGradient.width; childBox.y1 = 0; childBox.x2 = childBox.x1 + this._rightGradient.width; childBox.y2 = this.actor.height; - this._rightGradient.allocate(childBox, flags); + this._rightGradient.allocate(childBox); this._rightGradient.opacity = (this._scrollableRight && scrollable) ? 255 : 0; let arrowWidth = Math.floor(leftPadding / 3); @@ -551,7 +551,7 @@ SwitcherList.prototype = { childBox.y1 = this.actor.height / 2 - arrowWidth; childBox.x2 = childBox.x1 + arrowWidth; childBox.y2 = childBox.y1 + arrowHeight; - this._leftArrow.allocate(childBox, flags); + this._leftArrow.allocate(childBox); this._leftArrow.opacity = this._leftGradient.opacity; arrowWidth = Math.floor(rightPadding / 3); @@ -560,7 +560,7 @@ SwitcherList.prototype = { childBox.y1 = this.actor.height / 2 - arrowWidth; childBox.x2 = childBox.x1 + arrowWidth; childBox.y2 = childBox.y1 + arrowHeight; - this._rightArrow.allocate(childBox, flags); + this._rightArrow.allocate(childBox); this._rightArrow.opacity = this._rightGradient.opacity; }, @@ -699,7 +699,7 @@ SwitcherList.prototype = { alloc.natural_size = maxChildNat; }, - _allocate: function (actor, box, flags) { + _allocate: function (actor, box) { let childHeight = box.y2 - box.y1; let [maxChildMin, maxChildNat] = this._maxChildWidth(); @@ -730,7 +730,7 @@ SwitcherList.prototype = { childBox.y1 = vSpacing; childBox.x2 = x + childWidth; childBox.y2 = childBox.y1 + childNat; - children[i].allocate(childBox, flags); + children[i].allocate(childBox); x += this._list.spacing + childWidth; } else { diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js index 285451b412..ed71c1ba02 100644 --- a/js/ui/boxpointer.js +++ b/js/ui/boxpointer.js @@ -196,13 +196,13 @@ var BoxPointer = GObject.registerClass({ return themeNode.adjust_preferred_height(...height); } - vfunc_allocate(box, flags) { + vfunc_allocate(box) { if (this._sourceActor && this._sourceActor.mapped) { this._reposition(box); this._updateFlip(box); } - this.set_allocation(box, flags); + this.set_allocation(box); let themeNode = this.get_theme_node(); let borderWidth = themeNode.get_length('-arrow-border-width'); @@ -214,7 +214,7 @@ var BoxPointer = GObject.registerClass({ childBox.y1 = 0; childBox.x2 = availWidth; childBox.y2 = availHeight; - this._border.allocate(childBox, flags); + this._border.allocate(childBox); childBox.x1 = borderWidth; childBox.y1 = borderWidth; @@ -234,7 +234,7 @@ var BoxPointer = GObject.registerClass({ childBox.x2 -= rise; break; } - this.bin.allocate(childBox, flags); + this.bin.allocate(childBox); } _drawBorder(area) { diff --git a/js/ui/checkBox.js b/js/ui/checkBox.js index 769c78494e..aee944ab6b 100644 --- a/js/ui/checkBox.js +++ b/js/ui/checkBox.js @@ -4,38 +4,38 @@ const Pango = imports.gi.Pango; const St = imports.gi.St; var CheckBox = GObject.registerClass( -class CheckBox extends St.Button { - _init(label) { - let container = new St.BoxLayout(); - super._init({ - style_class: 'check-box', - important: true, - child: container, - button_mask: St.ButtonMask.ONE, - toggle_mode: true, - can_focus: true, - x_fill: true, - y_fill: true, - }); + class CheckBox extends St.Button { + _init(label) { + let container = new St.BoxLayout(); + super._init({ + style_class: 'check-box', + important: true, + child: container, + button_mask: St.ButtonMask.ONE, + toggle_mode: true, + can_focus: true, + x_fill: true, + y_fill: true, + }); - this._box = new St.Bin(); - this._box.set_y_align(Clutter.ActorAlign.START); - container.add_actor(this._box); + this._box = new St.Bin(); + this._box.set_y_align(Clutter.ActorAlign.START); + container.add_actor(this._box); - this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); - this._label.clutter_text.set_line_wrap(true); - this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE); - container.add_actor(this._label); + this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); + this._label.clutter_text.set_line_wrap(true); + this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE); + container.add_actor(this._label); - if (label) - this.setLabel(label); - } + if (label) + this.setLabel(label); + } - setLabel(label) { - this._label.set_text(label); - } + setLabel(label) { + this._label.set_text(label); + } - getLabelActor() { - return this._label; - } -}); + getLabelActor() { + return this._label; + } + }); diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 50072c6fbc..bc48349f75 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -721,7 +721,7 @@ GenericDragItemContainer.prototype = { this.animatingOut = false; }, - _allocate: function(actor, box, flags) { + _allocate: function(actor, box) { if (this.child == null) return; @@ -740,7 +740,7 @@ GenericDragItemContainer.prototype = { childBox.x2 = childBox.x1 + childWidth; childBox.y2 = childBox.y1 + childHeight; - this.child.allocate(childBox, flags); + this.child.allocate(childBox); }, _getPreferredHeight: function(actor, forWidth, alloc) { diff --git a/js/ui/expoThumbnail.js b/js/ui/expoThumbnail.js index 43a64973d6..417b269d82 100644 --- a/js/ui/expoThumbnail.js +++ b/js/ui/expoThumbnail.js @@ -1588,7 +1588,7 @@ ExpoThumbnailsBox.prototype = { themeNode.adjust_preferred_width(totalSpacing, Main.layoutManager.primaryMonitor.width); }, - allocate: function(actor, box, flags) { + allocate: function(actor, box) { this.box = box; let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL); @@ -1654,7 +1654,7 @@ ExpoThumbnailsBox.prototype = { childBox.y1 = box.y1; childBox.y2 = box.y2 + this.thumbnails[0].title.height; - this.background.allocate(childBox, flags); + this.background.allocate(childBox); let x; let y = spacing + Math.floor((availY - nRows * thumbnailHeight) / 2); @@ -1688,7 +1688,7 @@ ExpoThumbnailsBox.prototype = { let scale = this._scale * (1 - thumbnail.slidePosition); thumbnail.actor.set_scale(scale, scale); - thumbnail.actor.allocate(childBox, flags); + thumbnail.actor.allocate(childBox); let framethemeNode = thumbnail.frame.get_theme_node(); let borderWidth = framethemeNode.get_border_width(St.Side.BOTTOM); @@ -1697,14 +1697,14 @@ ExpoThumbnailsBox.prototype = { childBox.y1 = y1 - borderWidth; childBox.y2 = y2 + borderWidth; thumbnail.frame.set_scale((1 - thumbnail.slidePosition), (1 - thumbnail.slidePosition)); - thumbnail.frame.allocate(childBox, flags); + thumbnail.frame.allocate(childBox); let thumbnailx = Math.round(x + (thumbnailWidth * thumbnail.slidePosition / 2)); childBox.x1 = Math.max(thumbnailx, thumbnailx + Math.round(thumbnailWidth/2) - Math.round(thumbnail.title.width/2)); childBox.x2 = Math.min(thumbnailx + thumbnailWidth, childBox.x1 + thumbnail.title.width); childBox.y1 = y + thumbnailHeight + thTitleMargin; childBox.y2 = childBox.y1 + thumbnail.title.height; - thumbnail.title.allocate(childBox, flags); + thumbnail.title.allocate(childBox); x += thumbnailWidth + spacing; y += (i + 1) % nColumns > 0 ? 0 : thumbnailHeight + extraHeight + thTitleMargin; @@ -1728,7 +1728,7 @@ ExpoThumbnailsBox.prototype = { childBox.y1 = y; childBox.y2 = childBox.y1 + buttonHeight; - this.button.allocate(childBox, flags); + this.button.allocate(childBox); this.emit('allocated'); }, diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 9c8b2d0adc..2dd55496ad 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -194,9 +194,9 @@ function zoomOutActorAtPos(actor, x, y) { }); } -function animateIconPosition(icon, box, flags, nChangedIcons) { +function animateIconPosition(icon, box, nChangedIcons) { if (!icon.has_allocation() || icon.allocation.equal(box) || icon.opacity === 0) { - icon.allocate(box, flags); + icon.allocate(box); return false; } @@ -204,7 +204,7 @@ function animateIconPosition(icon, box, flags, nChangedIcons) { icon.set_easing_mode(Clutter.AnimationMode.EASE_OUT_QUAD); icon.set_easing_delay(nChangedIcons * ICON_POSITION_DELAY); - icon.allocate(box, flags); + icon.allocate(box); icon.restore_easing_state(); @@ -348,8 +348,8 @@ var IconGrid = GObject.registerClass({ return themeNode.adjust_preferred_height(height, height); } - vfunc_allocate(box, flags) { - this.set_allocation(box, flags); + vfunc_allocate(box) { + this.set_allocation(box); let themeNode = this.get_theme_node(); box = themeNode.get_content_box(box); @@ -395,7 +395,7 @@ var IconGrid = GObject.registerClass({ if (!animating) children[i].opacity = 255; - if (animateIconPosition(children[i], childBox, flags, nChangedIcons)) + if (animateIconPosition(children[i], childBox, nChangedIcons)) nChangedIcons++; } @@ -878,11 +878,11 @@ class PaginatedIconGrid extends IconGrid { return [height, height]; } - vfunc_allocate(box, flags) { + vfunc_allocate(box) { if (this._childrenPerPage == 0) log('computePages() must be called before allocate(); pagination will not work.'); - this.set_allocation(box, flags); + this.set_allocation(box); if (this._fillParent) { // Reset the passed in box to fill the parent @@ -915,7 +915,7 @@ class PaginatedIconGrid extends IconGrid { for (let i = 0; i < children.length; i++) { let childBox = this._calculateChildBox(children[i], x, y, box); - if (animateIconPosition(children[i], childBox, flags, nChangedIcons)) + if (animateIconPosition(children[i], childBox, nChangedIcons)) nChangedIcons++; children[i].show(); diff --git a/js/ui/keyboardManager.js b/js/ui/keyboardManager.js index b9ccc082d8..84eb09c2d8 100644 --- a/js/ui/keyboardManager.js +++ b/js/ui/keyboardManager.js @@ -252,8 +252,13 @@ var SubscriptableFlagIcon = GObject.registerClass({ this.add_child(this._drawingArea); +<<<<<<< HEAD this.connect('allocation-changed', () => { if (this._image == null) { +======= + this.connect("notify::allocation", () => { + GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { +>>>>>>> bbad7065a (Adapt to new alocation API) this._load_file(); } }); diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 963bc13f16..c2916fbacd 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -18,21 +18,21 @@ const Main = imports.ui.main; /* Imports...feel free to add here as needed */ var commandHeader = 'const Clutter = imports.gi.Clutter; ' + - 'const GLib = imports.gi.GLib; ' + - 'const Gtk = imports.gi.Gtk; ' + - 'const Mainloop = imports.mainloop; ' + - 'const Meta = imports.gi.Meta; ' + - 'const Cinnamon = imports.gi.Cinnamon; ' + - 'const Main = imports.ui.main; ' + - /* Utility functions...we should probably be able to use these - * in Cinnamon core code too. */ - 'const stage = global.stage; ' + - 'const color = function(pixel) { let c= new Clutter.Color(); c.from_pixel(pixel); return c; }; ' + - /* Special lookingGlass functions */ - 'const it = Main.lookingGlass.getIt(); ' + - 'const a = Main.lookingGlass.getWindowApp.bind(Main.lookingGlass); '+ - 'const w = Main.lookingGlass.getWindow.bind(Main.lookingGlass); '+ - 'const r = Main.lookingGlass.getResult.bind(Main.lookingGlass); '; +'const GLib = imports.gi.GLib; ' + +'const Gtk = imports.gi.Gtk; ' + +'const Mainloop = imports.mainloop; ' + +'const Meta = imports.gi.Meta; ' + +'const Cinnamon = imports.gi.Cinnamon; ' + +'const Main = imports.ui.main; ' + +/* Utility functions...we should probably be able to use these + * in Cinnamon core code too. */ +'const stage = global.stage; ' + +'const color = function(pixel) { let c= new Clutter.Color(); c.from_pixel(pixel); return c; }; ' + +/* Special lookingGlass functions */ +'const it = Main.lookingGlass.getIt(); ' + +'const a = Main.lookingGlass.getWindowApp.bind(Main.lookingGlass); '+ +'const w = Main.lookingGlass.getWindow.bind(Main.lookingGlass); '+ +'const r = Main.lookingGlass.getResult.bind(Main.lookingGlass); '; /* delay/aggregation period for window list updates. without a delay, the window * still exists in the get_window_actor() immediately after 'MetaWindow::unmanaged', @@ -79,11 +79,11 @@ function getObjInfo(o) { if (value.startsWith("[GjsFileImporter") || value.startsWith("[object GjsModule gi")) { type = "importer"; - } else if (value.startsWith("[boxed prototype")) { - type = "boxedproto"; - } else if (Array.isArray(o)) { - type = "array"; - } + } else if (value.startsWith("[boxed prototype")) { + type = "boxedproto"; + } else if (Array.isArray(o)) { + type = "array"; + } } // make empty strings/arrays obvious @@ -108,12 +108,12 @@ function getObjKeysInfo(obj) { let ownKeys; if (type === "array") ownKeys = curProto.keys(); // index properties only - else - ownKeys = Reflect.ownKeys(curProto); // all own properties and symbols + else + ownKeys = Reflect.ownKeys(curProto); // all own properties and symbols - // adding to set ignores duplicates - for (let key of ownKeys) - keys.add(key); + // adding to set ignores duplicates + for (let key of ownKeys) + keys.add(key); curProto = Object.getPrototypeOf(curProto); } @@ -125,10 +125,10 @@ function getObjKeysInfo(obj) { let [t, v] = getObjInfo(obj[k]); return { name: k.toString(), type: t, value: v, shortValue: "" }; } catch (e) { - return { name: k.toString(), type: '[inacessible]', value: '[inacessible]', shortValue: "" }; + return { name: k.toString(), type: '[inacessible]', value: '[inacessible]', shortValue: "" }; } } else { - return { name: k.toString(), type: '[inacessible]', value: '[inacessible]', shortValue: "" }; + return { name: k.toString(), type: '[inacessible]', value: '[inacessible]', shortValue: "" }; } }); } @@ -205,14 +205,14 @@ class WindowList { wmclass: metaWindow.get_wm_class() + '', app: '' }; - let app = tracker.get_window_app(metaWindow); - if (app != null && !app.is_window_backed()) { - lgInfo.app = app.get_id() + ''; - } else { - lgInfo.app = ''; - } + let app = tracker.get_window_app(metaWindow); + if (app != null && !app.is_window_backed()) { + lgInfo.app = app.get_id() + ''; + } else { + lgInfo.app = ''; + } - this.latestWindowList.push(lgInfo); + this.latestWindowList.push(lgInfo); } // Make sure the list changed before notifying listeners @@ -232,34 +232,34 @@ class WindowList { function addBorderPaintHook(actor) { let signalId = actor.connect_after('paint', - function (actor, paint_context) { - let framebuffer = paint_context.get_framebuffer(); - let coglContext = framebuffer.get_context(); - - if (!this._pipeline) { - let color = new Cogl.Color(); - color.init_from_4ub(0xff, 0, 0, 0xc4); - - this._pipeline = new Cogl.Pipeline(coglContext); - this._pipeline.set_color(color); - } - - let alloc = actor.get_allocation_box(); - let width = 2; - - // clockwise order - framebuffer.draw_rectangle(this._pipeline, - 0, 0, alloc.get_width(), width); - framebuffer.draw_rectangle(this._pipeline, - alloc.get_width() - width, width, - alloc.get_width(), alloc.get_height()); - framebuffer.draw_rectangle(this._pipeline, - 0, alloc.get_height(), - alloc.get_width() - width, alloc.get_height() - width); - framebuffer.draw_rectangle(this._pipeline, - 0, alloc.get_height() - width, - width, width); - }); + function (actor, paint_context) { + let framebuffer = paint_context.get_framebuffer(); + let coglContext = framebuffer.get_context(); + + if (!this._pipeline) { + let color = new Cogl.Color(); + color.init_from_4ub(0xff, 0, 0, 0xc4); + + this._pipeline = new Cogl.Pipeline(coglContext); + this._pipeline.set_color(color); + } + + let alloc = actor.get_allocation_box(); + let width = 2; + + // clockwise order + framebuffer.draw_rectangle(this._pipeline, + 0, 0, alloc.get_width(), width); + framebuffer.draw_rectangle(this._pipeline, + alloc.get_width() - width, width, + alloc.get_width(), alloc.get_height()); + framebuffer.draw_rectangle(this._pipeline, + 0, alloc.get_height(), + alloc.get_width() - width, alloc.get_height() - width); + framebuffer.draw_rectangle(this._pipeline, + 0, alloc.get_height() - width, + width, width); + }); actor.queue_redraw(); return signalId; @@ -317,15 +317,15 @@ var Inspector = GObject.registerClass({ _onCapturedEvent(actor, event) { if (event.type() == Clutter.EventType.KEY_PRESS && (event.get_key_symbol() === Clutter.KEY_Control_L || - event.get_key_symbol() === Clutter.KEY_Control_R || - event.get_key_symbol() === Clutter.KEY_Pause)) { + event.get_key_symbol() === Clutter.KEY_Control_R || + event.get_key_symbol() === Clutter.KEY_Pause)) { this.passThroughEvents = !this.passThroughEvents; - this._updatePassthroughText(); - return Clutter.EVENT_STOP; - } + this._updatePassthroughText(); + return Clutter.EVENT_STOP; + } - if (this.passThroughEvents) - return Clutter.EVENT_PROPAGATE; + if (this.passThroughEvents) + return Clutter.EVENT_PROPAGATE; switch (event.type()) { case Clutter.EventType.KEY_PRESS: @@ -341,23 +341,23 @@ var Inspector = GObject.registerClass({ } } - vfunc_allocate(box, flags) { + vfunc_allocate(box) { if (!this._eventHandler) return; - this.set_allocation(box, flags); + this.set_allocation(box); let primary = Main.layoutManager.primaryMonitor; let [minWidth, minHeight, natWidth, natHeight] = - this._eventHandler.get_preferred_size(); + this._eventHandler.get_preferred_size(); let childBox = new Clutter.ActorBox(); childBox.x1 = primary.x + Math.floor((primary.width - natWidth) / 2); childBox.x2 = childBox.x1 + natWidth; childBox.y1 = primary.y + Math.floor((primary.height - natHeight) / 2); childBox.y2 = childBox.y1 + natHeight; - this._eventHandler.allocate(childBox, flags); + this._eventHandler.allocate(childBox); } _close() { @@ -452,66 +452,66 @@ var Inspector = GObject.registerClass({ }); const melangeIFace = - ' \ - \ - \ - \ - \ - \ - \ - \ - '; +' \ + \ + \ + \ + \ + \ + \ + \ +'; const lgIFace = - ' \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - '; +' \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +'; var Melange = class { constructor() { @@ -544,14 +544,14 @@ var Melange = class { let nodeInfo = Gio.DBusNodeInfo.new_for_xml(melangeIFace); Gio.DBusProxy.new( - Gio.DBus.session, - Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION, - nodeInfo.lookup_interface("org.Cinnamon.Melange"), - "org.Cinnamon.Melange", - "/org/Cinnamon/Melange", - "org.Cinnamon.Melange", - null, - this._onProxyReady.bind(this) + Gio.DBus.session, + Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION, + nodeInfo.lookup_interface("org.Cinnamon.Melange"), + "org.Cinnamon.Melange", + "/org/Cinnamon/Melange", + "org.Cinnamon.Melange", + null, + this._onProxyReady.bind(this) ); } diff --git a/js/ui/panel.js b/js/ui/panel.js index a2628a7ed6..c9a4e1e813 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -1242,7 +1242,7 @@ TextShadower.prototype = { alloc.natural_size = natHeight + 2; }, - _allocate: function(actor, box, flags) { + _allocate: function(actor, box) { let children = this.actor.get_children(); let availWidth = box.x2 - box.x1; @@ -1284,7 +1284,7 @@ TextShadower.prototype = { } childBox.x2 = childBox.x1 + childWidth; childBox.y2 = childBox.y1 + childHeight; - child.allocate(childBox, flags); + child.allocate(childBox); } } }; @@ -3053,7 +3053,7 @@ Panel.prototype = { return; }, - _allocate: function(actor, box, flags) { + _allocate: function(actor, box) { let allocHeight = box.y2 - box.y1; let allocWidth = box.x2 - box.x1; @@ -3080,13 +3080,13 @@ Panel.prototype = { rightBoundary += box.y1; this._setVertChildbox (childBox, box.y1, leftBoundary); - this._leftBox.allocate(childBox, flags); + this._leftBox.allocate(childBox); this._setVertChildbox (childBox, leftBoundary, rightBoundary); - this._centerBox.allocate(childBox, flags); + this._centerBox.allocate(childBox); this._setVertChildbox (childBox, rightBoundary, box.y2); - this._rightBox.allocate(childBox, flags); + this._rightBox.allocate(childBox); } else { // horizontal panel /* Distribute sizes for the allocated width with points relative to @@ -3096,13 +3096,13 @@ Panel.prototype = { rightBoundary += box.x1; this._setHorizChildbox (childBox, box.x1, leftBoundary, leftBoundary, box.x2); - this._leftBox.allocate(childBox, flags); + this._leftBox.allocate(childBox); this._setHorizChildbox (childBox, leftBoundary, rightBoundary, rightBoundary, leftBoundary); - this._centerBox.allocate(childBox, flags); + this._centerBox.allocate(childBox); this._setHorizChildbox (childBox, rightBoundary, box.x2, box.x1, rightBoundary); - this._rightBox.allocate(childBox, flags); + this._rightBox.allocate(childBox); } }, diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index ef246eb060..3f1416f827 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -350,7 +350,7 @@ var PopupBaseMenuItem = class PopupBaseMenuItem { alloc.min_size = alloc.natural_size = height; } - _allocate(actor, box, flags) { + _allocate(actor, box) { let height = box.y2 - box.y1; let direction = this.actor.get_direction(); @@ -371,7 +371,7 @@ var PopupBaseMenuItem = class PopupBaseMenuItem { } dotBox.y1 = Math.round(box.y1 + (height - dotWidth) / 2); dotBox.y2 = dotBox.y1 + dotWidth; - this._dot.allocate(dotBox, flags); + this._dot.allocate(dotBox); } let x; @@ -465,7 +465,7 @@ var PopupBaseMenuItem = class PopupBaseMenuItem { childBox.y1 = Math.round(box.y1 + (height - naturalHeight) / 2); childBox.y2 = childBox.y1 + naturalHeight; - child.actor.allocate(childBox, flags); + child.actor.allocate(childBox); if (direction == St.TextDirection.LTR) x += availWidth + this._spacing; @@ -2621,8 +2621,8 @@ var PopupMenu = class PopupMenu extends PopupMenuBase { [alloc.min_size, alloc.natural_size] = this.box.get_preferred_height(forWidth); } - _boxAllocate (actor, box, flags) { - this.box.allocate(box, flags); + _boxAllocate (actor, box) { + this.box.allocate(box); } _allocationChanged (actor, pspec) { diff --git a/js/ui/virtualKeyboard.js b/js/ui/virtualKeyboard.js index 17748c6204..df7056d5ca 100644 --- a/js/ui/virtualKeyboard.js +++ b/js/ui/virtualKeyboard.js @@ -99,7 +99,7 @@ class AspectContainer extends St.Widget { return [min, nat]; } - vfunc_allocate(box, flags) { + vfunc_allocate(box) { if (box.get_width() > 0 && box.get_height() > 0) { let sizeRatio = box.get_width() / box.get_height(); @@ -117,7 +117,7 @@ class AspectContainer extends St.Widget { } } - super.vfunc_allocate(box, flags); + super.vfunc_allocate(box); } }); diff --git a/src/cinnamon-generic-container.c b/src/cinnamon-generic-container.c index f2bcedfd40..2b53fc2e79 100644 --- a/src/cinnamon-generic-container.c +++ b/src/cinnamon-generic-container.c @@ -60,19 +60,18 @@ cinnamon_generic_container_allocation_unref (CinnamonGenericContainerAllocation static void cinnamon_generic_container_allocate (ClutterActor *self, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StThemeNode *theme_node; ClutterActorBox content_box; - clutter_actor_set_allocation (self, box, flags); + clutter_actor_set_allocation (self, box); theme_node = st_widget_get_theme_node (ST_WIDGET (self)); st_theme_node_get_content_box (theme_node, box, &content_box); g_signal_emit (G_OBJECT (self), cinnamon_generic_container_signals[ALLOCATE], 0, - &content_box, flags); + &content_box); } static void @@ -371,7 +370,6 @@ cinnamon_generic_container_class_init (CinnamonGenericContainerClass *klass) * CinnamonGenericContainer::allocate: * @self: the #CinnamonGenericContainer * @box: @self's content box - * @flags: the allocation flags. * * Emitted when @self is allocated, after chaining up to the parent * allocate method. @@ -385,7 +383,7 @@ cinnamon_generic_container_class_init (CinnamonGenericContainerClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, - G_TYPE_NONE, 2, CLUTTER_TYPE_ACTOR_BOX, CLUTTER_TYPE_ALLOCATION_FLAGS); + G_TYPE_NONE, 2, CLUTTER_TYPE_ACTOR_BOX); g_type_class_add_private (gobject_class, sizeof (CinnamonGenericContainerPrivate)); } diff --git a/src/cinnamon-gtk-embed.c b/src/cinnamon-gtk-embed.c index 865087370d..53e0fe2eec 100644 --- a/src/cinnamon-gtk-embed.c +++ b/src/cinnamon-gtk-embed.c @@ -280,15 +280,14 @@ cinnamon_gtk_embed_get_preferred_height (ClutterActor *actor, static void cinnamon_gtk_embed_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { CinnamonGtkEmbed *embed = CINNAMON_GTK_EMBED (actor); CinnamonGtkEmbedPrivate *priv = cinnamon_gtk_embed_get_instance_private (embed); float wx, wy; CLUTTER_ACTOR_CLASS (cinnamon_gtk_embed_parent_class)-> - allocate (actor, box, flags); + allocate (actor, box); /* Find the actor's new coordinates in terms of the stage (which is * priv->window's parent window. diff --git a/src/cinnamon-slicer.c b/src/cinnamon-slicer.c index b92cfcb62e..b111d47e31 100644 --- a/src/cinnamon-slicer.c +++ b/src/cinnamon-slicer.c @@ -76,16 +76,15 @@ cinnamon_slicer_get_preferred_height (ClutterActor *self, static void cinnamon_slicer_allocate (ClutterActor *self, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { ClutterActor *child; - clutter_actor_set_allocation (self, box, flags); + clutter_actor_set_allocation (self, box); child = st_bin_get_child (ST_BIN (self)); if (child) - clutter_actor_allocate_preferred_size (child, flags); + clutter_actor_allocate_preferred_size (child); } static void diff --git a/src/cinnamon-stack.c b/src/cinnamon-stack.c index 95f6580e5c..be4495673f 100644 --- a/src/cinnamon-stack.c +++ b/src/cinnamon-stack.c @@ -22,14 +22,13 @@ G_DEFINE_TYPE (CinnamonStack, static void cinnamon_stack_allocate (ClutterActor *self, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (self)); ClutterActorBox content_box; ClutterActor *child; - clutter_actor_set_allocation (self, box, flags); + clutter_actor_set_allocation (self, box); st_theme_node_get_content_box (theme_node, box, &content_box); @@ -38,7 +37,7 @@ cinnamon_stack_allocate (ClutterActor *self, child = clutter_actor_get_next_sibling (child)) { ClutterActorBox child_box = content_box; - clutter_actor_allocate (child, &child_box, flags); + clutter_actor_allocate (child, &child_box); } } diff --git a/src/st/st-bin.c b/src/st/st-bin.c index c7b044834d..5134e36afd 100644 --- a/src/st/st-bin.c +++ b/src/st/st-bin.c @@ -93,12 +93,11 @@ clutter_container_iface_init (ClutterContainerIface *iface) static void st_bin_allocate (ClutterActor *self, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StBinPrivate *priv = ST_BIN (self)->priv; - clutter_actor_set_allocation (self, box, flags); + clutter_actor_set_allocation (self, box); if (priv->child && clutter_actor_is_visible (priv->child)) { @@ -111,8 +110,7 @@ st_bin_allocate (ClutterActor *self, &x_align_f, &y_align_f); clutter_actor_allocate_align_fill (priv->child, &childbox, x_align_f, y_align_f, - priv->x_fill, priv->y_fill, - flags); + priv->x_fill, priv->y_fill); } } diff --git a/src/st/st-entry.c b/src/st/st-entry.c index 005d2660d0..7b9cc4399b 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -429,8 +429,7 @@ st_entry_get_preferred_height (ClutterActor *actor, static void st_entry_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StEntryPrivate *priv = ST_ENTRY_PRIV (actor); StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor)); @@ -442,7 +441,7 @@ st_entry_allocate (ClutterActor *actor, is_rtl = clutter_actor_get_text_direction (actor) == CLUTTER_TEXT_DIRECTION_RTL; - clutter_actor_set_allocation (actor, box, flags); + clutter_actor_set_allocation (actor, box); st_theme_node_get_content_box (theme_node, box, &content_box); @@ -465,8 +464,7 @@ st_entry_allocate (ClutterActor *actor, icon_box.y2 = icon_box.y1 + icon_h; clutter_actor_allocate (priv->primary_icon, - &icon_box, - flags); + &icon_box); /* reduce the size for the entry */ child_box.x1 = MIN (child_box.x2, child_box.x1 + icon_w + priv->spacing); @@ -486,8 +484,7 @@ st_entry_allocate (ClutterActor *actor, icon_box.y2 = icon_box.y1 + icon_h; clutter_actor_allocate (priv->secondary_icon, - &icon_box, - flags); + &icon_box); /* reduce the size for the entry */ child_box.x2 = MAX (child_box.x1, child_box.x2 - icon_w - priv->spacing); @@ -509,7 +506,7 @@ st_entry_allocate (ClutterActor *actor, hint_box.y1 = ceil (content_box.y1 + avail_h / 2 - hint_h / 2); hint_box.y2 = hint_box.y1 + hint_h; - clutter_actor_allocate (priv->hint_actor, &hint_box, flags); + clutter_actor_allocate (priv->hint_actor, &hint_box); } clutter_actor_get_preferred_height (priv->entry, child_box.x2 - child_box.x1, @@ -520,7 +517,7 @@ st_entry_allocate (ClutterActor *actor, child_box.y1 = (int) (content_box.y1 + avail_h / 2 - entry_h / 2); child_box.y2 = child_box.y1 + entry_h; - clutter_actor_allocate (priv->entry, &child_box, flags); + clutter_actor_allocate (priv->entry, &child_box); } #define CURSOR_ON_MULTIPLIER 2 diff --git a/src/st/st-label.c b/src/st/st-label.c index f1326b4b23..5f605e3f50 100644 --- a/src/st/st-label.c +++ b/src/st/st-label.c @@ -164,18 +164,17 @@ st_label_get_preferred_height (ClutterActor *actor, static void st_label_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StLabelPrivate *priv = ST_LABEL (actor)->priv; StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor)); ClutterActorBox content_box; - clutter_actor_set_allocation (actor, box, flags); + clutter_actor_set_allocation (actor, box); st_theme_node_get_content_box (theme_node, box, &content_box); - clutter_actor_allocate (priv->label, &content_box, flags); + clutter_actor_allocate (priv->label, &content_box); } static void diff --git a/src/st/st-private.c b/src/st/st-private.c index 33b5c3a22d..15a122714f 100644 --- a/src/st/st-private.c +++ b/src/st/st-private.c @@ -467,8 +467,7 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec, if (width == 0 || height == 0) return NULL; - if (!clutter_actor_get_resource_scale (actor, &resource_scale)) - return NULL; + resource_scale = clutter_actor_get_resource_scale (actor); width = ceilf (width * resource_scale); height = ceilf (height * resource_scale); diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c index c4551b5e90..507531694c 100644 --- a/src/st/st-scroll-bar.c +++ b/src/st/st-scroll-bar.c @@ -192,8 +192,7 @@ st_scroll_bar_unmap (ClutterActor *actor) static void scroll_bar_allocate_children (StScrollBar *bar, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar); StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (bar)); @@ -207,7 +206,7 @@ scroll_bar_allocate_children (StScrollBar *bar, trough_box.y1 = content_box.y1; trough_box.x2 = content_box.x2; trough_box.y2 = content_box.y2; - clutter_actor_allocate (priv->trough, &trough_box, flags); + clutter_actor_allocate (priv->trough, &trough_box); } else { @@ -215,7 +214,7 @@ scroll_bar_allocate_children (StScrollBar *bar, trough_box.y1 = content_box.y1; trough_box.x2 = content_box.x2; trough_box.y2 = content_box.y2; - clutter_actor_allocate (priv->trough, &trough_box, flags); + clutter_actor_allocate (priv->trough, &trough_box); } @@ -275,8 +274,7 @@ scroll_bar_allocate_children (StScrollBar *bar, } clutter_actor_allocate (priv->handle, - &handle_box, - flags); + &handle_box); } } @@ -362,14 +360,13 @@ st_scroll_bar_get_preferred_height (ClutterActor *self, static void st_scroll_bar_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StScrollBar *bar = ST_SCROLL_BAR (actor); - clutter_actor_set_allocation (actor, box, flags); + clutter_actor_set_allocation (actor, box); - scroll_bar_allocate_children (bar, box, flags); + scroll_bar_allocate_children (bar, box); } static void @@ -392,7 +389,7 @@ scroll_bar_update_positions (StScrollBar *bar) return; clutter_actor_get_allocation_box (CLUTTER_ACTOR (bar), &box); - scroll_bar_allocate_children (bar, &box, CLUTTER_ALLOCATION_NONE); + scroll_bar_allocate_children (bar, &box); } static void diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c index 46335f5257..81331b5288 100644 --- a/src/st/st-scroll-view.c +++ b/src/st/st-scroll-view.c @@ -695,8 +695,7 @@ st_scroll_view_get_preferred_height (ClutterActor *actor, static void st_scroll_view_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { ClutterActorBox content_box, child_box; gfloat avail_width, avail_height, sb_width, sb_height; @@ -705,7 +704,7 @@ st_scroll_view_allocate (ClutterActor *actor, StScrollViewPrivate *priv = ST_SCROLL_VIEW (actor)->priv; StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor)); - clutter_actor_set_allocation (actor, box, flags); + clutter_actor_set_allocation (actor, box); st_theme_node_get_content_box (theme_node, box, &content_box); @@ -803,7 +802,7 @@ st_scroll_view_allocate (ClutterActor *actor, child_box.y1 = content_box.y1; child_box.y2 = content_box.y2 - (hscrollbar_visible ? sb_height : 0); - clutter_actor_allocate (priv->vscroll, &child_box, flags); + clutter_actor_allocate (priv->vscroll, &child_box); /* Horizontal scrollbar */ if (clutter_actor_get_text_direction (actor) == CLUTTER_TEXT_DIRECTION_RTL) @@ -819,7 +818,7 @@ st_scroll_view_allocate (ClutterActor *actor, child_box.y1 = content_box.y2 - sb_height; child_box.y2 = content_box.y2; - clutter_actor_allocate (priv->hscroll, &child_box, flags); + clutter_actor_allocate (priv->hscroll, &child_box); /* In case the scrollbar policy is NEVER or EXTERNAL or scrollbars * should be overlayed, we don't trim the content box allocation by @@ -851,7 +850,7 @@ st_scroll_view_allocate (ClutterActor *actor, child_box.y2 = content_box.y2 - sb_height; if (priv->child) - clutter_actor_allocate (priv->child, &child_box, flags); + clutter_actor_allocate (priv->child, &child_box); if (priv->hscrollbar_visible != hscrollbar_visible) { diff --git a/src/st/st-table.c b/src/st/st-table.c index 170e33fef8..6f342d464f 100644 --- a/src/st/st-table.c +++ b/src/st/st-table.c @@ -218,8 +218,7 @@ st_table_finalize (GObject *gobject) static void st_table_homogeneous_allocate (ClutterActor *self, - const ClutterActorBox *content_box, - gboolean flags) + const ClutterActorBox *content_box) { gfloat col_width, row_height; gint row_spacing, col_spacing; @@ -275,8 +274,7 @@ st_table_homogeneous_allocate (ClutterActor *self, clutter_actor_allocate_align_fill (child, &childbox, x_align_f, y_align_f, - meta->x_fill, meta->y_fill, - flags); + meta->x_fill, meta->y_fill); } } @@ -558,8 +556,7 @@ st_table_calculate_row_heights (StTable *table, static void st_table_preferred_allocate (ClutterActor *self, - const ClutterActorBox *content_box, - gboolean flags) + const ClutterActorBox *content_box) { gint row_spacing, col_spacing; gint i; @@ -687,21 +684,19 @@ st_table_preferred_allocate (ClutterActor *self, clutter_actor_allocate_align_fill (child, &childbox, x_align_f, y_align_f, - meta->x_fill, meta->y_fill, - flags); + meta->x_fill, meta->y_fill); } } static void st_table_allocate (ClutterActor *self, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StTablePrivate *priv = ST_TABLE (self)->priv; StThemeNode *theme_node; ClutterActorBox content_box; - clutter_actor_set_allocation (self, box, flags); + clutter_actor_set_allocation (self, box); if (priv->n_cols < 1 || priv->n_rows < 1) { @@ -712,9 +707,9 @@ st_table_allocate (ClutterActor *self, st_theme_node_get_content_box (theme_node, box, &content_box); if (priv->homogeneous) - st_table_homogeneous_allocate (self, &content_box, flags); + st_table_homogeneous_allocate (self, &content_box); else - st_table_preferred_allocate (self, &content_box, flags); + st_table_preferred_allocate (self, &content_box); } static void diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index 868e3773bd..730fab2b25 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -1157,7 +1157,7 @@ st_texture_cache_load_from_pixbuf (GdkPixbuf *pixbuf, "request-mode", CLUTTER_REQUEST_CONTENT_SIZE, NULL); - clutter_actor_get_resource_scale (actor, &resource_scale); + resource_scale = clutter_actor_get_resource_scale (actor); image = pixbuf_to_st_content_image (pixbuf, size, size, @@ -2214,4 +2214,4 @@ st_texture_cache_can_load_mime_type (StTextureCache *cache, return FALSE; return g_hash_table_contains (priv->image_type_table, mime_type); -} \ No newline at end of file +} diff --git a/src/st/st-viewport.c b/src/st/st-viewport.c index 56c4165d12..7b04e3db30 100644 --- a/src/st/st-viewport.c +++ b/src/st/st-viewport.c @@ -231,8 +231,7 @@ st_viewport_dispose (GObject *object) static void st_viewport_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StViewport *viewport = ST_VIEWPORT (actor); StViewportPrivate *priv = @@ -259,14 +258,14 @@ st_viewport_allocate (ClutterActor *actor, * may not match the minimum sizes reported by the layout manager. When that * happens, the content box needs to be adjusted to match the reported minimum * sizes before being passed to clutter_layout_manager_allocate() */ - clutter_actor_set_allocation (actor, box, flags); + clutter_actor_set_allocation (actor, box); content_box = viewport_box; content_box.x2 += MAX (0, min_width - avail_width); content_box.y2 += MAX (0, min_height - avail_height); clutter_layout_manager_allocate (layout, CLUTTER_CONTAINER (actor), - &content_box, flags); + &content_box); /* update adjustments for scrolling */ if (priv->vadjustment) diff --git a/src/st/st-widget.c b/src/st/st-widget.c index e9ac50d1e6..337a63438f 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -347,8 +347,7 @@ st_widget_get_preferred_height (ClutterActor *self, static void st_widget_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) + const ClutterActorBox *box) { StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor)); ClutterActorBox content_box; @@ -359,7 +358,7 @@ st_widget_allocate (ClutterActor *actor, * manager, meaning that we can't modify it for children only. */ - clutter_actor_set_allocation (actor, box, flags); + clutter_actor_set_allocation (actor, box); st_theme_node_get_content_box (theme_node, box, &content_box); @@ -367,8 +366,7 @@ st_widget_allocate (ClutterActor *actor, * currently installed layout manager */ clutter_layout_manager_allocate (clutter_actor_get_layout_manager (actor), CLUTTER_CONTAINER (actor), - &content_box, - flags); + &content_box); } /** diff --git a/tests/interactive/scroll-view-sizing.js b/tests/interactive/scroll-view-sizing.js index e8a6c73f88..470598707c 100644 --- a/tests/interactive/scroll-view-sizing.js +++ b/tests/interactive/scroll-view-sizing.js @@ -106,11 +106,10 @@ FlowedBoxes.prototype = { alloc.min_size = alloc.natural_size = height; }, - _allocate: function (actor, box, flags) { + _allocate: function (actor, box) { this._layoutChildren(box.x2 - box.x1, function(child, x1, y1, x2, y2) { - child.allocate(new Clutter.ActorBox({ x1: x1, y1: y1, x2: x2, y2: y2 }), - flags); + child.allocate(new Clutter.ActorBox({ x1: x1, y1: y1, x2: x2, y2: y2 })); }); } }; @@ -201,13 +200,12 @@ SizingIllustrator.prototype = { alloc.natural_size = 400; }, - _allocate: function (actor, box, flags) { + _allocate: function (actor, box) { let allocWidth = box.x2 - box.x1; let allocHeight = box.y2 - box.y1; function alloc(child, x1, y1, x2, y2) { - child.allocate(new Clutter.ActorBox({ x1: x1, y1: y1, x2: x2, y2: y2 }), - flags); + child.allocate(new Clutter.ActorBox({ x1: x1, y1: y1, x2: x2, y2: y2 })); } alloc(this.child, 0, 0, this.width, this.height); From 1e698c452e960895ea080a9225bf6e9a315bfb2d Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Fri, 20 Feb 2026 12:19:49 +0400 Subject: [PATCH 2/3] remove rebase comments --- js/ui/keyboardManager.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/js/ui/keyboardManager.js b/js/ui/keyboardManager.js index 84eb09c2d8..24b7011cd0 100644 --- a/js/ui/keyboardManager.js +++ b/js/ui/keyboardManager.js @@ -252,13 +252,8 @@ var SubscriptableFlagIcon = GObject.registerClass({ this.add_child(this._drawingArea); -<<<<<<< HEAD - this.connect('allocation-changed', () => { + this.connect('notify::allocation', () => { if (this._image == null) { -======= - this.connect("notify::allocation", () => { - GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { ->>>>>>> bbad7065a (Adapt to new alocation API) this._load_file(); } }); From 63caebec815f09464fd174f99f6265af703d85da Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Fri, 20 Feb 2026 17:01:37 +0400 Subject: [PATCH 3/3] fix indents --- js/ui/checkBox.js | 60 +++++----- js/ui/lookingGlass.js | 272 +++++++++++++++++++++--------------------- 2 files changed, 166 insertions(+), 166 deletions(-) diff --git a/js/ui/checkBox.js b/js/ui/checkBox.js index aee944ab6b..769c78494e 100644 --- a/js/ui/checkBox.js +++ b/js/ui/checkBox.js @@ -4,38 +4,38 @@ const Pango = imports.gi.Pango; const St = imports.gi.St; var CheckBox = GObject.registerClass( - class CheckBox extends St.Button { - _init(label) { - let container = new St.BoxLayout(); - super._init({ - style_class: 'check-box', - important: true, - child: container, - button_mask: St.ButtonMask.ONE, - toggle_mode: true, - can_focus: true, - x_fill: true, - y_fill: true, - }); +class CheckBox extends St.Button { + _init(label) { + let container = new St.BoxLayout(); + super._init({ + style_class: 'check-box', + important: true, + child: container, + button_mask: St.ButtonMask.ONE, + toggle_mode: true, + can_focus: true, + x_fill: true, + y_fill: true, + }); - this._box = new St.Bin(); - this._box.set_y_align(Clutter.ActorAlign.START); - container.add_actor(this._box); + this._box = new St.Bin(); + this._box.set_y_align(Clutter.ActorAlign.START); + container.add_actor(this._box); - this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); - this._label.clutter_text.set_line_wrap(true); - this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE); - container.add_actor(this._label); + this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); + this._label.clutter_text.set_line_wrap(true); + this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE); + container.add_actor(this._label); - if (label) - this.setLabel(label); - } + if (label) + this.setLabel(label); + } - setLabel(label) { - this._label.set_text(label); - } + setLabel(label) { + this._label.set_text(label); + } - getLabelActor() { - return this._label; - } - }); + getLabelActor() { + return this._label; + } +}); diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index c2916fbacd..7ec85cca73 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -18,21 +18,21 @@ const Main = imports.ui.main; /* Imports...feel free to add here as needed */ var commandHeader = 'const Clutter = imports.gi.Clutter; ' + -'const GLib = imports.gi.GLib; ' + -'const Gtk = imports.gi.Gtk; ' + -'const Mainloop = imports.mainloop; ' + -'const Meta = imports.gi.Meta; ' + -'const Cinnamon = imports.gi.Cinnamon; ' + -'const Main = imports.ui.main; ' + -/* Utility functions...we should probably be able to use these - * in Cinnamon core code too. */ -'const stage = global.stage; ' + -'const color = function(pixel) { let c= new Clutter.Color(); c.from_pixel(pixel); return c; }; ' + -/* Special lookingGlass functions */ -'const it = Main.lookingGlass.getIt(); ' + -'const a = Main.lookingGlass.getWindowApp.bind(Main.lookingGlass); '+ -'const w = Main.lookingGlass.getWindow.bind(Main.lookingGlass); '+ -'const r = Main.lookingGlass.getResult.bind(Main.lookingGlass); '; + 'const GLib = imports.gi.GLib; ' + + 'const Gtk = imports.gi.Gtk; ' + + 'const Mainloop = imports.mainloop; ' + + 'const Meta = imports.gi.Meta; ' + + 'const Cinnamon = imports.gi.Cinnamon; ' + + 'const Main = imports.ui.main; ' + + /* Utility functions...we should probably be able to use these + * in Cinnamon core code too. */ + 'const stage = global.stage; ' + + 'const color = function(pixel) { let c= new Clutter.Color(); c.from_pixel(pixel); return c; }; ' + + /* Special lookingGlass functions */ + 'const it = Main.lookingGlass.getIt(); ' + + 'const a = Main.lookingGlass.getWindowApp.bind(Main.lookingGlass); '+ + 'const w = Main.lookingGlass.getWindow.bind(Main.lookingGlass); '+ + 'const r = Main.lookingGlass.getResult.bind(Main.lookingGlass); '; /* delay/aggregation period for window list updates. without a delay, the window * still exists in the get_window_actor() immediately after 'MetaWindow::unmanaged', @@ -79,11 +79,11 @@ function getObjInfo(o) { if (value.startsWith("[GjsFileImporter") || value.startsWith("[object GjsModule gi")) { type = "importer"; - } else if (value.startsWith("[boxed prototype")) { - type = "boxedproto"; - } else if (Array.isArray(o)) { - type = "array"; - } + } else if (value.startsWith("[boxed prototype")) { + type = "boxedproto"; + } else if (Array.isArray(o)) { + type = "array"; + } } // make empty strings/arrays obvious @@ -108,12 +108,12 @@ function getObjKeysInfo(obj) { let ownKeys; if (type === "array") ownKeys = curProto.keys(); // index properties only - else - ownKeys = Reflect.ownKeys(curProto); // all own properties and symbols + else + ownKeys = Reflect.ownKeys(curProto); // all own properties and symbols - // adding to set ignores duplicates - for (let key of ownKeys) - keys.add(key); + // adding to set ignores duplicates + for (let key of ownKeys) + keys.add(key); curProto = Object.getPrototypeOf(curProto); } @@ -125,10 +125,10 @@ function getObjKeysInfo(obj) { let [t, v] = getObjInfo(obj[k]); return { name: k.toString(), type: t, value: v, shortValue: "" }; } catch (e) { - return { name: k.toString(), type: '[inacessible]', value: '[inacessible]', shortValue: "" }; + return { name: k.toString(), type: '[inacessible]', value: '[inacessible]', shortValue: "" }; } } else { - return { name: k.toString(), type: '[inacessible]', value: '[inacessible]', shortValue: "" }; + return { name: k.toString(), type: '[inacessible]', value: '[inacessible]', shortValue: "" }; } }); } @@ -205,14 +205,14 @@ class WindowList { wmclass: metaWindow.get_wm_class() + '', app: '' }; - let app = tracker.get_window_app(metaWindow); - if (app != null && !app.is_window_backed()) { - lgInfo.app = app.get_id() + ''; - } else { - lgInfo.app = ''; - } + let app = tracker.get_window_app(metaWindow); + if (app != null && !app.is_window_backed()) { + lgInfo.app = app.get_id() + ''; + } else { + lgInfo.app = ''; + } - this.latestWindowList.push(lgInfo); + this.latestWindowList.push(lgInfo); } // Make sure the list changed before notifying listeners @@ -232,34 +232,34 @@ class WindowList { function addBorderPaintHook(actor) { let signalId = actor.connect_after('paint', - function (actor, paint_context) { - let framebuffer = paint_context.get_framebuffer(); - let coglContext = framebuffer.get_context(); - - if (!this._pipeline) { - let color = new Cogl.Color(); - color.init_from_4ub(0xff, 0, 0, 0xc4); - - this._pipeline = new Cogl.Pipeline(coglContext); - this._pipeline.set_color(color); - } - - let alloc = actor.get_allocation_box(); - let width = 2; - - // clockwise order - framebuffer.draw_rectangle(this._pipeline, - 0, 0, alloc.get_width(), width); - framebuffer.draw_rectangle(this._pipeline, - alloc.get_width() - width, width, - alloc.get_width(), alloc.get_height()); - framebuffer.draw_rectangle(this._pipeline, - 0, alloc.get_height(), - alloc.get_width() - width, alloc.get_height() - width); - framebuffer.draw_rectangle(this._pipeline, - 0, alloc.get_height() - width, - width, width); - }); + function (actor, paint_context) { + let framebuffer = paint_context.get_framebuffer(); + let coglContext = framebuffer.get_context(); + + if (!this._pipeline) { + let color = new Cogl.Color(); + color.init_from_4ub(0xff, 0, 0, 0xc4); + + this._pipeline = new Cogl.Pipeline(coglContext); + this._pipeline.set_color(color); + } + + let alloc = actor.get_allocation_box(); + let width = 2; + + // clockwise order + framebuffer.draw_rectangle(this._pipeline, + 0, 0, alloc.get_width(), width); + framebuffer.draw_rectangle(this._pipeline, + alloc.get_width() - width, width, + alloc.get_width(), alloc.get_height()); + framebuffer.draw_rectangle(this._pipeline, + 0, alloc.get_height(), + alloc.get_width() - width, alloc.get_height() - width); + framebuffer.draw_rectangle(this._pipeline, + 0, alloc.get_height() - width, + width, width); + }); actor.queue_redraw(); return signalId; @@ -317,15 +317,15 @@ var Inspector = GObject.registerClass({ _onCapturedEvent(actor, event) { if (event.type() == Clutter.EventType.KEY_PRESS && (event.get_key_symbol() === Clutter.KEY_Control_L || - event.get_key_symbol() === Clutter.KEY_Control_R || - event.get_key_symbol() === Clutter.KEY_Pause)) { + event.get_key_symbol() === Clutter.KEY_Control_R || + event.get_key_symbol() === Clutter.KEY_Pause)) { this.passThroughEvents = !this.passThroughEvents; - this._updatePassthroughText(); - return Clutter.EVENT_STOP; - } + this._updatePassthroughText(); + return Clutter.EVENT_STOP; + } - if (this.passThroughEvents) - return Clutter.EVENT_PROPAGATE; + if (this.passThroughEvents) + return Clutter.EVENT_PROPAGATE; switch (event.type()) { case Clutter.EventType.KEY_PRESS: @@ -350,7 +350,7 @@ var Inspector = GObject.registerClass({ let primary = Main.layoutManager.primaryMonitor; let [minWidth, minHeight, natWidth, natHeight] = - this._eventHandler.get_preferred_size(); + this._eventHandler.get_preferred_size(); let childBox = new Clutter.ActorBox(); childBox.x1 = primary.x + Math.floor((primary.width - natWidth) / 2); @@ -452,66 +452,66 @@ var Inspector = GObject.registerClass({ }); const melangeIFace = -' \ - \ - \ - \ - \ - \ - \ - \ -'; + ' \ + \ + \ + \ + \ + \ + \ + \ + '; const lgIFace = -' \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -'; + ' \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + '; var Melange = class { constructor() { @@ -544,14 +544,14 @@ var Melange = class { let nodeInfo = Gio.DBusNodeInfo.new_for_xml(melangeIFace); Gio.DBusProxy.new( - Gio.DBus.session, - Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION, - nodeInfo.lookup_interface("org.Cinnamon.Melange"), - "org.Cinnamon.Melange", - "/org/Cinnamon/Melange", - "org.Cinnamon.Melange", - null, - this._onProxyReady.bind(this) + Gio.DBus.session, + Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION, + nodeInfo.lookup_interface("org.Cinnamon.Melange"), + "org.Cinnamon.Melange", + "/org/Cinnamon/Melange", + "org.Cinnamon.Melange", + null, + this._onProxyReady.bind(this) ); }