mate-desktop / mate-panel

MATE panel
https://mate-desktop.org
GNU General Public License v2.0
184 stars 115 forks source link

"Time" Applet Lacks Padding on the Left-and-Right Sides #778

Closed MingcongBai closed 1 year ago

MingcongBai commented 6 years ago

Expected behaviour

The "time" applet on the MATE Panel should have a couple pixels of padding for its left and right sides, especially when placed on the right corners.

Actual behaviour

Currently the applet has no padding whatsoever, the time displayed appears to be "touching" the edge of the display, which makes the applet seem incomplete ("is my time displayed completely?") and could result in cut-offs on certain displays. Please refer to the screenshot below.

2018-04-15 12-25-57

Steps to reproduce the behaviour

Create a panel and put the "time" applet to the right-most edge of the panel (which should be 100% in width).

MATE general version

MATE Panel 1.20.1.

Package version

MATE Panel 1.20.1.

Linux Distribution

AOSC OS.

Link to downstream report of your Distribution

N/A.

DrReD commented 6 years ago

In my machine this also leads the the following problem: Fedora Bugzilla#1405795

(I can supply the Arial font for testing, but it is the usual Microsoft Arial Font distributed with office 2016)

MingcongBai commented 6 years ago

Well mine simply doesn't have any padding to the right...

rkw-inspiron commented 5 years ago

I found that adding a few pixels in mate-panel/applets/clock/clock.c line 1283 "" padding: 0px;\n" solves this

lukefromdc commented 5 years ago

I do NOT want forced padding on the clock or any other applet on my setup that cannot be overridden by themes. The real question is why was this set up with hardcoded 0px in the first place: was the applet jumping on focus or something? Perhaps the function name "force_no_button_padding" is an indicator of this. If the issue is buttons in some themes changing dimensions with focus or click, that's a theme issue as it would always cause jumping buttons and not just in the panel.

lukefromdc commented 5 years ago

One more point: since that padding value is loaded with GTK_STYLE_PROVIDER_PRIORITY_APPLICATION , you can override it with something like

clock-applet-button {

padding: 3px;

}

Added to ~/.config/gtk-3.0/gtk.css and you can create this file with just those lines if it does not exist. This will give you the padding you (or any distro) want without having to modify and recompile the source code. Theme values from that file load with GTK_STYLE_PROVIDER_PRIORITY_USER and thus override everything else (USER should never be used in application code for this reason).

rkw-inspiron commented 5 years ago

Ok. Thanks! Maybe then such a style snippet could be incorporated into the themes that are shipped by MATE, if the developers feel so inclined. As far as the origin of this, it was present in mate-panel-1.1.0 as "force_no_focus_padding" so as far as

why was this set up with hardcoded 0px in the first place: was the applet jumping on focus or something? Perhaps the function name "force_no_button_padding" is an indicator of this.

Maybe the original cause is no longer there... I compiled mate-panel with the function completely removed and saw no difference in behavior

lukefromdc commented 5 years ago

A theme could not apply that directly as GTK_STYLE_PROVIDER_PRIORITY_APPLICATION overrides the GTK theme files. It might be able to use an element within the button such as label, but that would also increase spacing between labels for date, time etc.

rkw-inspiron commented 5 years ago

So for origin we have force_no_focus_padding added in gnome panel 2.8.0.1 back in 2004 with the reason " Ignore focus padding so we fit nicely on a 24px panel (Mark) " then in mate-panel 1.17.1 it's changed to force_no_button_padding because it " GTK 3.20/22 Clock button: force zero padding and margin Stops negative allocation warnings unless theme sets a border"

lukefromdc commented 5 years ago

One thing from that function we definately need to keep is setting the widget name, but that could be moved elsewhere. I will now test this with GTK 3.24 and see if we get negative allocation warnings without the hardcoded zero padding.

lukefromdc commented 5 years ago

OK, we no longer get that warning with GTK 3.22 or with GTK 3.24, and no other GTK version is supported. Also clock applet fits itself fine even to panels below 24px, all the way down to the 17px miniumum value.. I will push a PR to remove the forced zero padding

muktupavels commented 5 years ago

I think warnings are disabled in stable versions... You need unstable version or you need to enable warnings!

lukefromdc commented 5 years ago

Oh yeah: a debug build of GTK gets lots of underallocation warnings with this code removed, including specific clockbox references:

(mate-panel:6314): Gtk-WARNING **: 17:11:36.353: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x565131d137e0. Allocation is 1x26, but minimum required size is -1x48.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.353: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletFrameDBus's child MatePanelAppletContainer 0x565131d15d70. Allocation is 1x26, but minimum required size is -1x48.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.353: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletContainer's child MatePanelApplet 0x56513197e820. Allocation is 1x26, but minimum required size is -1x48.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.353: gtk_widget_size_allocate(): attempt to underallocate MatePanelApplet's child WnckPager 0x565131dd11d0. Allocation is 1x26, but minimum required size is -1x48.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.364: ClockBox 0x565131efb400 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.364: GtkLabel 0x565131ef4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.682: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x565131d13420. Allocation is 11x26, but minimum required size is 1216x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.682: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletFrameDBus's child MatePanelAppletContainer 0x565131d15a10. Allocation is 1x26, but minimum required size is 1206x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.682: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletContainer's child MatePanelApplet 0x56513197e610. Allocation is 1x26, but minimum required size is 1206x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.682: gtk_widget_size_allocate(): attempt to underallocate MatePanelApplet's child WnckTasklist 0x565131dc6280. Allocation is 1x26, but minimum required size is 1206x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.693: ClockBox 0x565131efb400 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.693: GtkLabel 0x565131ef4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.702: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x565131d13420. Allocation is 741x26, but minimum required size is 1216x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.702: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletFrameDBus's child MatePanelAppletContainer 0x565131d15a10. Allocation is 731x26, but minimum required size is 1206x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.702: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletContainer's child MatePanelApplet 0x56513197e610. Allocation is 731x26, but minimum required size is 1206x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.702: gtk_widget_size_allocate(): attempt to underallocate MatePanelApplet's child WnckTasklist 0x565131dc6280. Allocation is 731x26, but minimum required size is 1206x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.703: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x565131d13ba0. Allocation is 16x26, but minimum required size is 16x35.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.703: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletFrameDBus's child MatePanelAppletContainer 0x565131da7200. Allocation is 16x26, but minimum required size is 16x35.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.703: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletContainer's child GtkSocket 0x565131ee3d60. Allocation is 16x26, but minimum required size is 16x35.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.712: ClockBox 0x565131efb400 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.712: GtkLabel 0x565131ef4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.719: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x565131d13420. Allocation is 741x26, but minimum required size is 1216x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.719: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x565131d13ba0. Allocation is 16x26, but minimum required size is 16x35.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.731: ClockBox 0x565131efb400 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.731: GtkLabel 0x565131ef4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.749: ClockBox 0x565131efb400 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:36.749: GtkLabel 0x565131ef4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:38.262: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x565131d13420. Allocation is 741x26, but minimum required size is 1216x26.

(mate-panel:6314): Gtk-WARNING **: 17:11:38.275: ClockBox 0x565131efb400 is drawn without a current allocation. This should not happen.

(mate-panel:6314): Gtk-WARNING **: 17:11:38.275: GtkLabel 0x565131ef4bb0 is drawn without a current allocation. This should not happen.
lukefromdc commented 5 years ago

Turns out with master (with force zero padding) we get this set of warnings, still including the clockbox, so the code in question is not doing its former job on this:

(mate-panel:24527): Gtk-WARNING **: 17:21:16.806: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x55ef0efe17e0. Allocation is 1x26, but minimum required size is -1x48.

(mate-panel:24527): Gtk-WARNING **: 17:21:16.806: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletFrameDBus's child MatePanelAppletContainer 0x55ef0efe3d70. Allocation is 1x26, but minimum required size is -1x48.

(mate-panel:24527): Gtk-WARNING **: 17:21:16.806: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletContainer's child MatePanelApplet 0x55ef0ec4a820. Allocation is 1x26, but minimum required size is -1x48.

(mate-panel:24527): Gtk-WARNING **: 17:21:16.806: gtk_widget_size_allocate(): attempt to underallocate MatePanelApplet's child WnckPager 0x55ef0f09e1f0. Allocation is 1x26, but minimum required size is -1x48.

(mate-panel:24527): Gtk-WARNING **: 17:21:16.816: ClockBox 0x55ef0f1c0400 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:16.816: GtkLabel 0x55ef0f1c4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.124: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x55ef0efe1420. Allocation is 11x26, but minimum required size is 1417x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.124: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletFrameDBus's child MatePanelAppletContainer 0x55ef0efe3a10. Allocation is 1x26, but minimum required size is 1407x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.124: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletContainer's child MatePanelApplet 0x55ef0ec4a610. Allocation is 1x26, but minimum required size is 1407x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.124: gtk_widget_size_allocate(): attempt to underallocate MatePanelApplet's child WnckTasklist 0x55ef0f094260. Allocation is 1x26, but minimum required size is 1407x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.124: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x55ef0efe1ba0. Allocation is 16x26, but minimum required size is 16x35.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.124: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletFrameDBus's child MatePanelAppletContainer 0x55ef0f075200. Allocation is 16x26, but minimum required size is 16x35.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.124: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletContainer's child GtkSocket 0x55ef0f1afd50. Allocation is 16x26, but minimum required size is 16x35.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.140: ClockBox 0x55ef0f1c0400 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.140: GtkLabel 0x55ef0f1c4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.148: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x55ef0efe1420. Allocation is 723x26, but minimum required size is 1417x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.148: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletFrameDBus's child MatePanelAppletContainer 0x55ef0efe3a10. Allocation is 713x26, but minimum required size is 1407x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.148: gtk_widget_size_allocate(): attempt to underallocate MatePanelAppletContainer's child MatePanelApplet 0x55ef0ec4a610. Allocation is 713x26, but minimum required size is 1407x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.148: gtk_widget_size_allocate(): attempt to underallocate MatePanelApplet's child WnckTasklist 0x55ef0f094260. Allocation is 713x26, but minimum required size is 1407x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.150: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x55ef0efe1ba0. Allocation is 16x26, but minimum required size is 16x35.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.159: ClockBox 0x55ef0f1c0400 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.159: GtkLabel 0x55ef0f1c4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.182: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x55ef0efe1420. Allocation is 723x26, but minimum required size is 1417x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.182: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x55ef0efe1ba0. Allocation is 16x26, but minimum required size is 16x35.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.194: ClockBox 0x55ef0f1c0400 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.194: GtkLabel 0x55ef0f1c4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.213: ClockBox 0x55ef0f1c0400 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:17.213: GtkLabel 0x55ef0f1c4bb0 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:18.242: gtk_widget_size_allocate(): attempt to underallocate PanelWidget's child MatePanelAppletFrameDBus 0x55ef0efe1420. Allocation is 723x26, but minimum required size is 1417x26.

(mate-panel:24527): Gtk-WARNING **: 17:21:18.259: ClockBox 0x55ef0f1c0400 is drawn without a current allocation. This should not happen.

(mate-panel:24527): Gtk-WARNING **: 17:21:18.259: GtkLabel 0x55ef0f1c4bb0 is drawn without a current allocation. This should not happen.
lukefromdc commented 5 years ago

On looking at the warnings, all the "clockbox" warnings are the same in master and with this PR, and are limited to

(mate-panel:6314): Gtk-WARNING **: 17:11:36.731: ClockBox 0x565131efb400 is drawn without a current allocation. This should not happen.

The underallocation warnings immediately above this are for a GtkSocket, and since my clock is built in-process these are for something else taking up 16x35 on my panel.

Thus, the proposed removal of force_no_focus_padding does not seem to create any additional warnings, will push a PR for it as it is a simplification and gives themers more control

lukefromdc commented 5 years ago

https://github.com/mate-desktop/mate-panel/pull/896 removes hardcoded padding, but I am never going to hardcode a non-zero padding value for this.

raveit65 commented 1 year ago

Seems the issue is fixed.