Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed hide-corners bug #140

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions [email protected]/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,25 @@ function modify_panel() {
/* Register text color styling. */
let [text, icon, arrow] = Theming.register_text_color(Settings.get_text_color()); // eslint-disable-line no-unused-vars
let [maximized_text, maximized_icon, maximized_arrow] = Theming.register_text_color(Settings.get_maximized_text_color(), 'maximized'); // eslint-disable-line no-unused-vars

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

if (Settings.get_enable_text_color()) {
if (text !== null) {
Theming.set_text_color();
} else {
log('[Dynamic Panel Transparency] Failed to enabled text coloring.');
}
}

/* Register hide corners. */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* Register hide corners. */

let hide_corners = Theming.register_hide_corners();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let hide_corners = Theming.register_hide_corners();


if (Settings.get_hide_corners()) {
if (hide_corners !== null) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove conditional.

Theming.add_hide_corners();
} else {
log('[Dynamic Panel Transparency] Failed to enable hide corners.');
}
}
}

function unmodify_panel() {
Expand Down Expand Up @@ -154,7 +165,11 @@ function initialize_settings() {
name: 'hide_corners',
type: 'b',
handler: (function() {
Transitions.update_corner_alpha();
if (Settings.get_hide_corners()) {
Theming.add_hide_corners();
} else {
Theming.remove_hide_corners();
}
}.bind(this))
});
Settings.add({
Expand Down Expand Up @@ -206,7 +221,7 @@ function initialize_settings() {

for (let i = Theming.stylesheets.length - 1; i >= 0; i--) {
let stylesheet = Theming.stylesheets[i];
if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel-') !== -1) {
if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel-') !== -1 && stylesheet.indexOf('panel-hide-corners') == -1) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert.

theme.unload_stylesheet(Util.get_file(stylesheet));
Util.remove_file(stylesheet);
Theming.stylesheets.splice(i, 1);
Expand Down Expand Up @@ -247,7 +262,7 @@ function initialize_settings() {

for (let i = Theming.stylesheets.length - 1; i >= 0; i--) {
let stylesheet = Theming.stylesheets[i];
if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel-') !== -1) {
if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel-') !== -1 && stylesheet.indexOf('panel-hide-corners') == -1) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert.

theme.unload_stylesheet(Util.get_file(stylesheet));
Util.remove_file(stylesheet);
Theming.stylesheets.splice(i, 1);
Expand Down Expand Up @@ -285,7 +300,7 @@ function initialize_settings() {

for (let i = Theming.stylesheets.length - 1; i >= 0; i--) {
let stylesheet = Theming.stylesheets[i];
if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel.dpt.css') !== -1) {
if (stylesheet.indexOf('background') !== -1 && stylesheet.indexOf('panel.dpt.css') !== -1 && stylesheet.indexOf('panel-hide-corners') == -1) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert.

theme.unload_stylesheet(Util.get_file(stylesheet));
Util.remove_file(stylesheet);
Theming.stylesheets.splice(i, 1);
Expand Down
3 changes: 3 additions & 0 deletions [email protected]/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
background-image: none;
}

/* Prevents overlapping of corners + top bar when using transparency */
.panel-corner {
ajbucci marked this conversation as resolved.
Show resolved Hide resolved
-panel-corner-border-width: 0px;}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-panel-corner-border-width: 0px;}
-panel-corner-border-width: 0px;
}

27 changes: 26 additions & 1 deletion [email protected]/theming.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* exported init, cleanup, remove_maximized_background_color, remove_unmaximized_background_color, set_maximized_background_color, set_unmaximized_background_color, remove_background_color, register_text_shadow, add_text_shadow, register_icon_shadow, add_icon_shadow, has_text_shadow, has_icon_shadow, remove_text_shadow, remove_icon_shadow, register_text_color, set_text_color, remove_text_color, set_panel_color, set_corner_color, clear_corner_color, get_background_image_color, get_background_color, get_maximized_opacity, get_unmaximized_opacity, strip_panel_styling, reapply_panel_styling, strip_panel_background_image, reapply_panel_background_image, strip_panel_background, reapply_panel_background, set_background_alpha */
/* exported init, cleanup, register_hide_corners, add_hide_corners, remove_hide_corners, remove_maximized_background_color, remove_unmaximized_background_color, set_maximized_background_color, set_unmaximized_background_color, remove_background_color, register_text_shadow, add_text_shadow, register_icon_shadow, add_icon_shadow, has_text_shadow, has_icon_shadow, remove_text_shadow, remove_icon_shadow, register_text_color, set_text_color, remove_text_color, set_panel_color, set_corner_color, clear_corner_color, get_background_image_color, get_background_color, get_maximized_opacity, get_unmaximized_opacity, strip_panel_styling, reapply_panel_styling, strip_panel_background_image, reapply_panel_background_image, strip_panel_background, reapply_panel_background, set_background_alpha */

const St = imports.gi.St;

Expand Down Expand Up @@ -150,6 +150,31 @@ function has_icon_shadow() {
function remove_text_shadow() {
Panel.remove_style_class_name('dpt-panel-text-shadow');
}
/**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove register_hide_corners - you don't need a dynamic stylesheet for a static style.

* Registers a hide corners stylesheet.
*
*/
function register_hide_corners() {
let stylesheet = apply_stylesheet_css('.dpt-panel-hide-corners .panel-corner { -panel-corner-radius: 0px; }', 'background/panel-hide-corners');

register_style('dpt-panel-hide-corners');

return stylesheet;
}
/**
* Adds the currently registered hide corners stylesheet to the corners of the panel.
*
*/
function add_hide_corners() {
Panel.add_style_class_name('dpt-panel-hide-corners');
}
/**
* Unhides corners; deregistering the stylesheet and removing the css.
*
*/
function remove_hide_corners() {
Panel.remove_style_class_name('dpt-panel-hide-corners');
}

/**
* Removes any icon shadowing; deregistering the stylesheet and removing the css.
Expand Down