✨ Tweak clang-format style

This commit is contained in:
Simon Schneegans
2022-03-04 20:39:12 +01:00
parent 28c1cb6d72
commit 77310f9e65
7 changed files with 109 additions and 114 deletions
+2
View File
@@ -1,4 +1,6 @@
BasedOnStyle: Google BasedOnStyle: Google
AlignConsecutiveAssignments: true AlignConsecutiveAssignments: true
AlignAfterOpenBracket: Align
ContinuationIndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true KeepEmptyLinesAtTheStartOfBlocks: true
ColumnLimit: 90 ColumnLimit: 90
+2 -2
View File
@@ -461,8 +461,8 @@ class Extension {
// Update uniforms at each frame. // Update uniforms at each frame.
transition.connect('new-frame', (t) => { transition.connect('new-frame', (t) => {
shader.set_uniform_value('uProgress', testMode ? 0.5 : t.get_progress()); shader.set_uniform_value('uProgress', testMode ? 0.5 : t.get_progress());
shader.set_uniform_value( shader.set_uniform_value('uTime',
'uTime', testMode ? duration / 2 : 0.001 * t.get_elapsed_time()); testMode ? duration / 2 : 0.001 * t.get_elapsed_time());
shader.set_uniform_value('uSizeX', actor.width); shader.set_uniform_value('uSizeX', actor.width);
shader.set_uniform_value('uSizeY', actor.height); shader.set_uniform_value('uSizeY', actor.height);
}); });
+6 -11
View File
@@ -64,12 +64,10 @@ var PreferencesDialog = class PreferencesDialog {
const styleProvider = Gtk.CssProvider.new(); const styleProvider = Gtk.CssProvider.new();
styleProvider.load_from_resource('/css/gtk.css'); styleProvider.load_from_resource('/css/gtk.css');
if (utils.isGTK4()) { if (utils.isGTK4()) {
Gtk.StyleContext.add_provider_for_display( Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(), styleProvider,
Gdk.Display.get_default(), styleProvider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
} else { } else {
Gtk.StyleContext.add_provider_for_screen( Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), styleProvider,
Gdk.Screen.get_default(), styleProvider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
} }
@@ -481,15 +479,14 @@ var PreferencesDialog = class PreferencesDialog {
// Each effect page is based on a template widget. This template contains the title // Each effect page is based on a template widget. This template contains the title
// and the preview button. // and the preview button.
// clang-format off
if (GObject.type_from_name('BurnMyWindowsEffectPage') == null) { if (GObject.type_from_name('BurnMyWindowsEffectPage') == null) {
BurnMyWindowsEffectPage = BurnMyWindowsEffectPage = GObject.registerClass(
GObject.registerClass({ {
GTypeName: 'BurnMyWindowsEffectPage', GTypeName: 'BurnMyWindowsEffectPage',
Template: `resource:///ui/${utils.getGTKString()}/effectPage.ui`, Template: `resource:///ui/${utils.getGTKString()}/effectPage.ui`,
InternalChildren: ['label', 'button'], InternalChildren: ['label', 'button'],
}, },
class BurnMyWindowsEffectPage extends Gtk.Box { class BurnMyWindowsEffectPage extends Gtk.Box { // ------------------------------
_init(Effect, dialog) { _init(Effect, dialog) {
super._init(); super._init();
@@ -498,7 +495,6 @@ var PreferencesDialog = class PreferencesDialog {
// Open the preview window once the preview button is clicked. // Open the preview window once the preview button is clicked.
this._button.connect('clicked', () => { this._button.connect('clicked', () => {
// Set the to-be-previewed effect. // Set the to-be-previewed effect.
dialog.getSettings().set_string('open-preview-effect', Effect.getNick()); dialog.getSettings().set_string('open-preview-effect', Effect.getNick());
dialog.getSettings().set_string('close-preview-effect', Effect.getNick()); dialog.getSettings().set_string('close-preview-effect', Effect.getNick());
@@ -509,7 +505,7 @@ var PreferencesDialog = class PreferencesDialog {
// Create the preview-window. // Create the preview-window.
const window = new Gtk.Window({ const window = new Gtk.Window({
// Translators: %s will be replaced by the effect's name. // Translators: %s will be replaced by the effect's name.
title: _('Preview for %s').replace("%s", Effect.getLabel()), title: _('Preview for %s').replace('%s', Effect.getLabel()),
default_width: 800, default_width: 800,
default_height: 450, default_height: 450,
modal: true, modal: true,
@@ -554,7 +550,6 @@ var PreferencesDialog = class PreferencesDialog {
}); });
} }
}); });
// clang-format on
} }
} }
} }
+4 -5
View File
@@ -134,9 +134,8 @@ if (utils.isInShellProcess()) {
// this texture is also re-created each time. This could be improved in the future! // this texture is also re-created each time. This could be improved in the future!
const shardData = GdkPixbuf.Pixbuf.new_from_resource('/img/shards.png'); const shardData = GdkPixbuf.Pixbuf.new_from_resource('/img/shards.png');
this._shardTexture = new Clutter.Image(); this._shardTexture = new Clutter.Image();
this._shardTexture.set_data( this._shardTexture.set_data(shardData.get_pixels(), Cogl.PixelFormat.RGB_888,
shardData.get_pixels(), Cogl.PixelFormat.RGB_888, shardData.width, shardData.width, shardData.height, shardData.rowstride);
shardData.height, shardData.rowstride);
// Usually, the shards fly away from the center of the window. // Usually, the shards fly away from the center of the window.
let epicenterX = 0.5; let epicenterX = 0.5;
@@ -232,8 +231,8 @@ if (utils.isInShellProcess()) {
const pipeline = this.get_pipeline(); const pipeline = this.get_pipeline();
// Use linear filtering for the window texture. // Use linear filtering for the window texture.
pipeline.set_layer_filters( pipeline.set_layer_filters(0, Cogl.PipelineFilter.LINEAR,
0, Cogl.PipelineFilter.LINEAR, Cogl.PipelineFilter.LINEAR); Cogl.PipelineFilter.LINEAR);
// Bind the shard texture. // Bind the shard texture.
pipeline.set_layer_texture(1, this._shardTexture.get_texture()); pipeline.set_layer_texture(1, this._shardTexture.get_texture());
+2 -3
View File
@@ -125,9 +125,8 @@ if (utils.isInShellProcess()) {
// See assets/README.md for how this texture was created. // See assets/README.md for how this texture was created.
const clawData = GdkPixbuf.Pixbuf.new_from_resource('/img/claws.png'); const clawData = GdkPixbuf.Pixbuf.new_from_resource('/img/claws.png');
this._clawTexture = new Clutter.Image(); this._clawTexture = new Clutter.Image();
this._clawTexture.set_data( this._clawTexture.set_data(clawData.get_pixels(), Cogl.PixelFormat.RGB_888,
clawData.get_pixels(), Cogl.PixelFormat.RGB_888, clawData.width, clawData.width, clawData.height, clawData.rowstride);
clawData.height, clawData.rowstride);
const color = const color =
Clutter.Color.from_string(settings.get_string('claw-scratch-color'))[1]; Clutter.Color.from_string(settings.get_string('claw-scratch-color'))[1];