rozniak / xfce-winxp-tc

Windows XP stuff for XFCE
Other
979 stars 34 forks source link

Start menu xfce-panel plugin #21

Closed rozniak closed 3 years ago

rozniak commented 4 years ago

Whilst theming the built in task switcher and application launcher plugins for xfce-panel is nice, it would be neat to have a proper Start menu (with the Start button) and XP-like taskbar for a closer experience to XP.

With my tiny knowledge of GTK, I suppose the Start stuff could be put together using subclassed GtkButton for the button itself and GtkPopover for the Start menu flyout. Perhaps could reference existing launchers to see how this is achieved.

For the taskbar, I know how to use WNCK for watching open windows so it is mostly the GUI portion that needs looking into.

rozniak commented 3 years ago

I have started working on this in feat-21 branch. Toying around with the Start button at the moment, including styles in the Luna theme. Here's what it looks like:

image

It's pretty close - might want to tweak the text-shadow a bit to get closer to XP. And yes, this is text-based, so it can be localized.

Some notes on file paths: startbutton.desktop goes in /usr/share/xfce4/panel/plugins libstartbutton-plugin.so goes in /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins Images under /res go in /usr/share/winxp/shell-res

The button is currently just a GtkButton, though this will need changing to GtkMenuButton so that the Start menu can be implemented as a GtkPopover.

Will also shift out the Start button as its own class, instead of the current rough proof-of-concept of the plugin code simply building a button in place.

rozniak commented 3 years ago

Sadly the GtkPopover idea isn't going to work - the popover will not display because it lives outside the bounds of the xfce-panel.

Complex problem I think - perhaps might be able to use a GtkToggleButton alongside creating a window with no decoration positioned as required...

rozniak commented 3 years ago

This worked a treat - the menu is now a GtkWindow with no decoration, and will pop up when the button is toggled. Aligned using the XFCE panel API. image

Added the tooltip as well (not localized yet though). image

rozniak commented 3 years ago

Cleaned up the code a little bit now that this is partially functional.

rozniak commented 3 years ago

Start menu structure is there, will do some styling now.

image

rozniak commented 3 years ago

Styling is there for the most part now - I need to do a few more things to get this looking right: image

Next tasks:

In future will need to figure out sizing, whether to figure out how to fill the blank space or simply add a bunch of programs in so it remains the same height always...?

Also need to make sure the columns are always 50-50 - truncate the menu labels if they are too long for programs (places should be fine).

rozniak commented 3 years ago

Start menu now using CSD and looking good style-wise. image

I have noticed a weird bug though, and this is unrelated to the CSD code:

Normally the focus-out-event signal fires to hide the window, this works absolutely fine when clicking off the window or focusing another window. I have noticed a strange case though - when the menu window is open, and you select one of the caption buttons on a different window (XFWM4 decorations) - gtk_widget_hide doesn't function correctly. The menu window does not respond to any events, you cannot click on it or anything - if it's in CSD mode it does not render, but it still exists (blocks mouse activity in the area where the window is, even if you can't see it). The window can still be moved as well (including programmatically).

I'm not sure what is going on, I have fiddled with the code with various ideas, but nothing seems to fix this.

This call to gtk_widget_hide is where the problem occurs - and adding return TRUE to prevent other signal handlers running does not fix the problem. Neither does using gtk_window_close instead. https://github.com/rozniak/xfce-winxp-tc/blob/feat-21/shell/start/src/startmenu.c#L376

rozniak commented 3 years ago

Tested with XFCE 4.16 on Debian Testing, this bug doesn't occur. Presumably a bug in 4.12, which Debian 10 ships with. :cry:

rozniak commented 3 years ago

Gotten a lot further since my last comment - I'm currently getting some functionality together and the remaining styles done. Was poking around the source for XFCE's application menu to see how that works and found it uses libgarcon so I have been working with that. I have it displaying the default applications menu so far under the All Programs item.

Here's a screeny of what things are currently looking like: image

rozniak commented 3 years ago

Getting there - work has been done on actually dynamically loading the programs from desktop entries, providing custom menu files, and fixing up some remaining styling: image

Launching programs sort of works, the Firefox and Thunderbird items aren't working though. Not too much of a worry, I need to fiddle around with the launching in general.

Next things I plan to do:

rozniak commented 3 years ago

Program launching appears to now be resolved as I have implemented the 'field code' expansion and made use of g_shell_parse_argv to construct our launch command. I have also hopefully patched away any memory leaks - referred to GTK and XFCE source code to double check what refs/ownership there are so things should be correct this end.

I should keep the scope of this particular issue small as this is a huge chunk of code waiting to be merged. As such I plan to get things relatively functional, merge this issue, then open more specific issues for features awaiting implementation on the Start menu.

These things should be done and then branch merged:

Once this stuff is done, will merge this branch and create separate issues for things to be done in future.

rozniak commented 3 years ago

The above things have all been completed - going to merge this work into master now and create issues for outstanding things to work on in future. It is now possible to use the Start menu fully in place of the XFCE Applications Menu. :grin: image