D10461: GMenu-DBusMenu-Proxy

2018-03-09 Thread Kai Uwe Broulik
broulik closed this revision.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma, mart, davidedmundson
Cc: davidedmundson, mart, rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, 
lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol


D10461: GMenu-DBusMenu-Proxy

2018-03-06 Thread Kai Uwe Broulik
broulik updated this revision to Diff 28838.
broulik added a comment.


  Fix UTF8_STRING atom type check

REPOSITORY
  R120 Plasma Workspace

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10461?vs=28836=28838

REVISION DETAIL
  https://phabricator.kde.org/D10461

AFFECTED FILES
  CMakeLists.txt
  gmenu-dbusmenu-proxy/CMakeLists.txt
  gmenu-dbusmenu-proxy/Messages.sh
  gmenu-dbusmenu-proxy/actions.cpp
  gmenu-dbusmenu-proxy/actions.h
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.cpp
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.h
  gmenu-dbusmenu-proxy/gmenudbusmenuproxy.desktop
  gmenu-dbusmenu-proxy/icons.cpp
  gmenu-dbusmenu-proxy/icons.h
  gmenu-dbusmenu-proxy/main.cpp
  gmenu-dbusmenu-proxy/menu.cpp
  gmenu-dbusmenu-proxy/menu.h
  gmenu-dbusmenu-proxy/menuproxy.cpp
  gmenu-dbusmenu-proxy/menuproxy.h
  gmenu-dbusmenu-proxy/utils.cpp
  gmenu-dbusmenu-proxy/utils.h
  gmenu-dbusmenu-proxy/window.cpp
  gmenu-dbusmenu-proxy/window.h

To: broulik, #plasma, mart, davidedmundson
Cc: davidedmundson, mart, rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, 
lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol


D10461: GMenu-DBusMenu-Proxy

2018-03-06 Thread Kai Uwe Broulik
broulik updated this revision to Diff 28836.
broulik added a comment.


  - Fix leaks
  - Cleanup

REPOSITORY
  R120 Plasma Workspace

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10461?vs=28320=28836

REVISION DETAIL
  https://phabricator.kde.org/D10461

AFFECTED FILES
  CMakeLists.txt
  gmenu-dbusmenu-proxy/CMakeLists.txt
  gmenu-dbusmenu-proxy/Messages.sh
  gmenu-dbusmenu-proxy/actions.cpp
  gmenu-dbusmenu-proxy/actions.h
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.cpp
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.h
  gmenu-dbusmenu-proxy/gmenudbusmenuproxy.desktop
  gmenu-dbusmenu-proxy/icons.cpp
  gmenu-dbusmenu-proxy/icons.h
  gmenu-dbusmenu-proxy/main.cpp
  gmenu-dbusmenu-proxy/menu.cpp
  gmenu-dbusmenu-proxy/menu.h
  gmenu-dbusmenu-proxy/menuproxy.cpp
  gmenu-dbusmenu-proxy/menuproxy.h
  gmenu-dbusmenu-proxy/utils.cpp
  gmenu-dbusmenu-proxy/utils.h
  gmenu-dbusmenu-proxy/window.cpp
  gmenu-dbusmenu-proxy/window.h

To: broulik, #plasma, mart, davidedmundson
Cc: davidedmundson, mart, rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, 
lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol


D10461: GMenu-DBusMenu-Proxy

2018-03-06 Thread Kai Uwe Broulik
broulik marked 5 inline comments as done.
broulik added inline comments.

INLINE COMMENTS

> davidedmundson wrote in icons.cpp:24
> does this list come from anywhere?

It was done trial and error by running couple of gtk apps (gedit, gimp, 
inkscape, shotwell) etc, the kde 4 appmenu also had something like this albeit 
less elaborate

> davidedmundson wrote in menuproxy.cpp:195
> are these always set before the window is created?

I haven't seen it not working and wasn't really keen on playing with native 
event filters again as I did in appmenu applet

> davidedmundson wrote in menuproxy.cpp:249
> what's this about?

KDE stuff shows up in `xprop` as

  _KDE_NET_WM_APPMENU_OBJECT_PATH(STRING) = "/MenuBar/1"

note the `STRING` whereas GTK shows up as

  _GTK_APPLICATION_OBJECT_PATH(UTF8_STRING)

note the `UTF8_STRING`. I did not find the corresponding type enum anywhere and 
it also seems to be different for different machines

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma, mart, davidedmundson
Cc: davidedmundson, mart, rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, 
lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol


D10461: GMenu-DBusMenu-Proxy

2018-03-06 Thread David Edmundson
davidedmundson requested changes to this revision.
davidedmundson added a comment.
This revision now requires changes to proceed.


  Fundamental design seems fine.
  
  It's a massive patchset, I'm not sure I've got my head round all of it yet, I 
might take a second round when these minor things are addressed.

INLINE COMMENTS

> actions.cpp:62
> +QDBusPendingReply reply = 
> QDBusConnection::sessionBus().asyncCall(msg);
> +QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, 
> this);
> +connect(watcher, ::finished, this, 
> [this](QDBusPendingCallWatcher *watcher) {

leak

> actions.cpp:119
> +QDBusPendingReply reply = 
> QDBusConnection::sessionBus().asyncCall(msg);
> +QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, 
> this);
> +connect(watcher, ::finished, this, [this, 
> name](QDBusPendingCallWatcher *watcher) {

leak

> gmenudbusmenuproxy.desktop:7
> +OnlyShowIn=KDE;
> +X-KDE-autostart-phase=0

Why 0?

> icons.cpp:24
> +
> +QString Icons::actionIcon(const QString )
> +{

does this list come from anywhere?

> menu.cpp:98
> +qCWarning(DBUSMENUPROXY) << "Got an empty menu for" << id << 
> "on" << m_serviceName << "at" << m_objectPath;
> +return;
> +}

watcher leaked

> menu.cpp:127
> +QDBusPendingReply reply = 
> QDBusConnection::sessionBus().asyncCall(msg);
> +QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, 
> this);
> +connect(watcher, ::finished, this, [this, 
> ids](QDBusPendingCallWatcher *watcher) {

and again...

> menuproxy.cpp:195
> +
> +if (applicationMenuObjectPath.isEmpty() && menuBarObjectPath.isEmpty()) {
> +return;

are these always set before the window is created?

> menuproxy.cpp:249
> +// FIXME Check type
> +if (/*propertyReply->type == 392 && */propertyReply->format == 8 && 
> propertyReply->value_len > 0) {
> +const char *data = (const char *) 
> xcb_get_property_value(propertyReply.data());

what's this about?

> window.cpp:92
> +if (!m_applicationObjectPath.isEmpty()) {
> +m_applicationActions = new Actions(m_serviceName, 
> m_applicationObjectPath);
> +connect(m_applicationActions, ::actionsChanged, this, 
> [this](const QStringList ) {

who owns this?

> window.cpp:357
> +
> +new DbusmenuAdaptor(this); // do this before registering the object?
> +

I think it's safe, you'd have definitely added it before we process someone 
introspecting the path.

But why write it one way round and add a question when we can just move it.

> window.cpp:606
> +if (!accel.isEmpty()) {
> +// TODO replace "+" by "plus" and "-" by "minus"
> +shortcut.append(accel);

so do so?

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma, mart, davidedmundson
Cc: davidedmundson, mart, rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, 
lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol


D10461: GMenu-DBusMenu-Proxy

2018-03-01 Thread Marco Martin
mart accepted this revision as: mart.
mart added a comment.
This revision is now accepted and ready to land.


  looks good to me, partial shipit, is so big that i think is better if another 
one reviews it too

INLINE COMMENTS

> window.cpp:288
> +} else {
> +emit LayoutUpdated(2 /*revision*/, id);
> +}

always 2? maybe needs a more in depth comment?

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma, mart
Cc: mart, rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol


D10461: GMenu-DBusMenu-Proxy

2018-02-28 Thread Kai Uwe Broulik
broulik edited the summary of this revision.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-28 Thread Kai Uwe Broulik
broulik updated this revision to Diff 28255.
broulik edited the test plan for this revision.
broulik added a comment.


  - Split icon mapping into dedicated namespace and extend it a lot
  - Monitor menus right away so we know if there's actually a menu 
(appmenu-gtk-module always claims to have a menu even if there is none)
  - Expand sections on the fly so ID mapping is correct and updating actions 
works ("Undo" action in LibreOffice updates fine now)
  - Fall back from menu bar to application menu on the fly (appmenu-gtk-module 
always announces a menu bar even if the app might only have an app menu)
  - Let "items to be added" also create new sections, fixes switching from 
LibreOffice Splash to Writer where the menu is replaced entirely
  - Fix updating visible/enabled property of actions at runtime
  - A couple of sanity checks and crash fixes

REPOSITORY
  R120 Plasma Workspace

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10461?vs=27142=28255

REVISION DETAIL
  https://phabricator.kde.org/D10461

AFFECTED FILES
  CMakeLists.txt
  gmenu-dbusmenu-proxy/CMakeLists.txt
  gmenu-dbusmenu-proxy/Messages.sh
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.cpp
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.h
  gmenu-dbusmenu-proxy/gmenudbusmenuproxy.desktop
  gmenu-dbusmenu-proxy/icons.cpp
  gmenu-dbusmenu-proxy/icons.h
  gmenu-dbusmenu-proxy/main.cpp
  gmenu-dbusmenu-proxy/menu.cpp
  gmenu-dbusmenu-proxy/menu.h
  gmenu-dbusmenu-proxy/menuproxy.cpp
  gmenu-dbusmenu-proxy/menuproxy.h

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Konstantin
rilian added a comment.


  UPD: disabled an exporting of empty menubar on X11. Try latest 
appmenu-gtk-module master, please.
  I do not know how to do it in GTK Wayland.
  
  Can you explain me KDE Wayland Global Menu architecture?

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Konstantin
rilian added a comment.


  If you need help, I will provide it for you, because for me there is 2 
features which should be in KDE for me:
  
  1. Global Menu (for all protocols)
  2. QGtkStyle (with GTK3 themes)
  
  
  
  > Okay. Problem is that for example LibreOffice doesn't have a menu right 
away, so I can't realy tell "no menu because it's still loading" or "no menu 
because it doesn't have one" and then fallback to app menu. I could perhaps 
check if the app has an appmenu at all before trying to fallback but not really 
fond of adding even more complexity to it.
  
  I too because MenuModel can be empty on start, and I cannot differ than user 
turned menu off or just application do not have a menu?
  About searching of appmenu and fallback to it - LibreOffice have both appmenu 
and menubar, so, we will lose LibreOffice menu.
  
  > What kind of different actions? So far I have only had redundancy in the 
app menu, I'll try to look into this, merging two separate menus into one 
somehow, also getting the app name for the app menu..
  
  It can be actions (GActions, I mean) than exists only in appmenu, but not in 
menubar. User may want this.
  
  > How am I supposed to know which action belongs where?
  
  But all menuitems have "action" attribute)
  Or if you about a QAction (which, I think, should called QMenuItem), this is 
several ways to do this:
  
  1. Look for each section, name it by some action-name regex (as you did with 
icons) and then show it as menubar.
  2. Or just do it with each menuitem, but it is way more complicated. I 
suggest a section-way.
  
  
  
  > That was just for the icon mapping, I can probably remove this, since the 
actions in unity are just their localized labels plus unity. prefix, there's 
nothing I can map them to (like I would be able to window.open to document-open 
icon)
  
  I think you do not need mapping, because we have a bunch of this code:
  
C
static GtkImage *gtk_menu_item_get_nth_image(GtkMenuItem *menu_item, guint 
index)
{
UnityGtkSearch search;

g_return_val_if_fail(GTK_IS_MENU_ITEM(menu_item), NULL);

search.type   = GTK_TYPE_IMAGE;
search.index  = index;
search.object = NULL;

g_object_get_nth_object(G_OBJECT(menu_item), );

return search.object != NULL ? GTK_IMAGE(search.object) : NULL;
}

static GIcon *gtk_image_get_icon(GtkImage *image)
{
GIcon *icon = NULL;

g_return_val_if_fail(GTK_IS_IMAGE(image), NULL);

switch (gtk_image_get_storage_type(image))
{
case GTK_IMAGE_GICON:
{
gtk_image_get_gicon(image, , NULL);

if (icon != NULL)
g_object_ref(icon);
}

break;

case GTK_IMAGE_ICON_NAME:
{
const char *name = NULL;

gtk_image_get_icon_name(image, , NULL);

if (name != NULL)
icon = 
G_ICON(g_themed_icon_new_with_default_fallbacks(name));
}

break;

case GTK_IMAGE_PIXBUF:
{
GdkPixbuf *pixbuf = gtk_image_get_pixbuf(image);

if (pixbuf != NULL)
icon = g_object_ref(pixbuf);
}

break;

case GTK_IMAGE_ANIMATION:
{
GdkPixbufAnimation *animation = gtk_image_get_animation(image);

if (animation != NULL)
{
GdkPixbuf *pixbuf = 
gdk_pixbuf_animation_get_static_image(animation);

if (pixbuf != NULL)
icon = g_object_ref(pixbuf);
}
}

break;

case GTK_IMAGE_STOCK:
#if GTK_MAJOR_VERSION == 2
{
char *stock  = NULL;
GtkIconSize size = GTK_ICON_SIZE_INVALID;

gtk_image_get_stock(image, , );

if (stock != NULL)
{
GdkPixbuf *pixbuf =
gtk_widget_render_icon(GTK_WIDGET(image), stock, 
size, NULL);

if (pixbuf != NULL)
icon = G_ICON(pixbuf);
}
}
#elif GTK_MAJOR_VERSION == 3
{
GtkStyleContext *context = 
gtk_widget_get_style_context(GTK_WIDGET(image));

if (context != NULL)
{
char *stock  = NULL;
GtkIconSize size = GTK_ICON_SIZE_INVALID;

gtk_image_get_stock(image, , );

if (stock != NULL)
{
GtkIconSet *set = 
gtk_style_context_lookup_icon_set(context, stock);

if (set != NULL)
{

D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Kai Uwe Broulik
broulik added a comment.


  Thanks for your input!
  
  > Yes, menubar may be empty
  
  Okay. Problem is that for example LibreOffice doesn't have a menu right away, 
so I can't realy tell "no menu because it's still loading" or "no menu because 
it doesn't have one" and then fallback to app menu. I could perhaps check if 
the app has an appmenu at all before trying to fallback but not really fond of 
adding even more complexity to it.
  
  > GTK3 applications (file-roller, for example) can use both appmenu and 
menubar with different items (and different action)
  
  What kind of different actions? So far I have only had redundancy in the app 
menu, I'll try to look into this, merging two separate menus into one somehow, 
also getting the app name for the app menu..
  
  > You can add New Window and Quit to File menu, Sidebar to View, Preferences 
and Keyboard shortcuts to Tools (or Edit), and Help and About to help.
  
  How am I supposed to know which action belongs where?
  
  > What about FIXME unity, what are you mean?
  
  That was just for the icon mapping, I can probably remove this, since the 
actions in unity are just their localized labels plus `unity.` prefix, there's 
nothing I can map them to (like I would be able to `window.open` to 
`document-open` icon)

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Konstantin
rilian added a comment.


  What about FIXME unity, what are you mean? I can fix appmenu-gtk-module for 
you.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Konstantin
rilian added a comment.


  O, some another note: You can generate menubar from appmenu.
  For example, Nautilus:
  It have 4 sections
  
  1. New Window
  2. Sidebar
  3. Preferences
  4. Keyboard Shortcuts Help About Quit.
  
  You can add New Window and Quit to File menu, Sidebar to View, Preferences 
and Keyboard shortcuts to Tools (or Edit), and Help and About to help.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Konstantin
rilian added a comment.


  1. Yes, menubar may be empty with appmenu-gtk-module or unity-gtk-module, and 
if I can fix appmenu-gtk-module, unity-gtk-module will not be fixed. So, I 
think it is preferred to check on your side.
  2. GTK3 applications (file-roller, for example) can use both appmenu and 
menubar with different items (and different action) . So, I think, hiding 
appmenu is bad, because user may want this menu entries.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Kai Uwe Broulik
broulik added a comment.


  > So, Unity is dead, but unity action prefixes is live.
  
  I just added support for that but I don't know what apps use it to test it, 
if you may..? :)
  
  > To use unity-gtk-module or appmenu-gtk-module you need to install it into 
correct location (where all gtk modules is located) and then add its name 
(unity-gtk-module or appmenu-gtk-module) to environment variable called 
GTK_MODULES.
  
  I just did that and now get a full menu in e.g. Pluma. However, most other 
apps, like Evince, don't get a menu at all anymore. It seems the the 
appmenu-gtk-module always announces a menu bar which may be empty? :/ My proxy 
does not fallback to empty menus, it only falls back when the menu property 
doesn't exist to begin with and I wouldn't really want to make it even more 
complex as it is.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Kai Uwe Broulik
broulik updated this revision to Diff 27142.
broulik edited the test plan for this revision.
broulik added a comment.


  - Support unity actions (untested)
  - Don't mandate actions to be present, it's perfectly valid for a window to 
have a menu only consisting of application actions or vice-versa
  - Improve action update logic, signal `ItemsPropertiesUpdated` when an action 
changes instead of rebuilding the layout
  - Improve menu update logic, just update the existing items when the same 
number of items is removed and added

REPOSITORY
  R120 Plasma Workspace

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10461?vs=27077=27142

REVISION DETAIL
  https://phabricator.kde.org/D10461

AFFECTED FILES
  CMakeLists.txt
  gmenu-dbusmenu-proxy/CMakeLists.txt
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.cpp
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.h
  gmenu-dbusmenu-proxy/gmenudbusmenuproxy.desktop
  gmenu-dbusmenu-proxy/main.cpp
  gmenu-dbusmenu-proxy/menu.cpp
  gmenu-dbusmenu-proxy/menu.h
  gmenu-dbusmenu-proxy/menuproxy.cpp
  gmenu-dbusmenu-proxy/menuproxy.h

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Konstantin
rilian added a comment.


  Thanks so much)
  
  1. Unity is dead, but I forked unity-gtk-module, patched it for all distros, 
fixed some bugs and called appmenu-gtk-module. So, Unity is dead, but unity 
action prefixes is live.
  2. To use unity-gtk-module or appmenu-gtk-module you need to install it into 
correct location (where all gtk modules is located) and then add its name 
(unity-gtk-module or appmenu-gtk-module) to environment variable called 
GTK_MODULES. If it will not working with appmenu-gtk-module, write me. 
unity-gtk-module maintainers is not so responsive.
  3. Menu can use only application actions, only window actions and only unity 
actions. And all this are correct, as well as any combination of it (but not 
empty combination).

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rk, rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-14 Thread Kai Uwe Broulik
broulik added a comment.


  Hi Konstantin,
  thank you very much for your input!
  
  > One can be missing, and then incomplete menu should render:
  
  In Plasma we don't typically use this separate "app menu" (although I'd like 
to do that but as a separate menu), so what I do is I show the menu bar and if 
that is not there I'll try the app menu. I never show both of them at once to 
be consistent with KDE apps that only have a menu.
  
  > c) If both are missing, you will not see a menu (Protocol is incorrect)
  
  I don't understand. Incorrect on my side? When both menus are missing where 
should I get the menu from?
  
  > Unity (_UNITY_OBJECT_PATH, prefix unity) - it is non-standard, but widely 
used action path for set a Unity actions (when window actions is not supported 
by app developer). It is object path supported by unity-gtk-module and 
appmenu-gtk-module.
  
  I was already wondering what the `unity.` prefixed actions I saw mentioned in 
a script I looked at. I just installed `unity-gtk2-module` and tried with some 
GTK2 apps but I don't see any new window properties. What else do I need to get 
GTK2 working? (Also given Unity is basically dead and a Ubuntu-specifica, won't 
really help us on non-*buntu distributions, right?)
  
  > If any of this are missing, this menu items should be rendered as disabled. 
But if menu using actions only from one category - it can be used as a normal 
menu. Setting this all is not required for functional menu. One will be enough, 
if menu is using actions only from one group.
  
  You mean that I don't neccessarily need both application and window actions 
in case the menu just uses application actions? I'll fix that.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-13 Thread Konstantin
rilian added a comment.


  Hello, I am Konstantin, developer of vala-panel-appmenu. I have some comments 
about your application.
  
  MenuModel protocol consitsts for 5 items:
  
AppMenu - with property _GTK_APPMENU_OBJECT_PATH
MenuBar - with property _GTK_MENUBAR_OBJECT_PATH
It is a menu models, it is how menu should drawn on screen.
One can be missing, and then incomplete menu should render:
a) If AppMenu is missing, you will miss menu entry with application name 
(vala-panel-appmenu renders stub in place of missing AppMenu)
b) If MenuBar is missing, you will miss all menu entries except entry with 
application name.
c) If both are missing, you will not see a menu (Protocol is incorrect)
  
  And 3 providers of actions. Actions is required to get menu react on user 
changes.Providers:
  
Application (_GTK_APPLICATION_OBJECT_PATH, prefix app) - it is actions from 
all application (not bound to a particular window)
Window (_GTK_WINDOW_OBJECT_PATH, prefix win) - it is actions from current 
window, as it set by a developer of application
Unity (_UNITY_OBJECT_PATH, prefix unity) - it is non-standard, but widely 
used action path for set a Unity actions (when window actions is not supported 
by app developer). It is object path supported by unity-gtk-module and 
appmenu-gtk-module.
If you implement this, you will get GTK2 menu for free.
If any of this are missing, this menu items should be rendered as disabled. 
But if menu using actions only from one category - it can be used as a normal 
menu. Setting this all is not required for functional menu. One will be enough, 
if menu is using actions only from one group.

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D10461

To: broulik, #plasma
Cc: rilian, mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart


D10461: GMenu-DBusMenu-Proxy

2018-02-13 Thread Kai Uwe Broulik
broulik updated this revision to Diff 27077.
broulik retitled this revision from "WIP: GMenu-DBusMenu-Proxy" to 
"GMenu-DBusMenu-Proxy".
broulik edited the summary of this revision.
broulik added a comment.


  - Cleanup code and use categorized logging
  - Monitor action changes (e.g. toggled state of checkbox)
  - Monitor menu changes (e.g. menu label changed)
  - Handle when app has no menu on startup but gets one later
  - Disable GTK menu bar when we're running

REPOSITORY
  R120 Plasma Workspace

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D10461?vs=26999=27077

REVISION DETAIL
  https://phabricator.kde.org/D10461

AFFECTED FILES
  CMakeLists.txt
  gmenu-dbusmenu-proxy/CMakeLists.txt
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.cpp
  gmenu-dbusmenu-proxy/gdbusmenutypes_p.h
  gmenu-dbusmenu-proxy/gmenudbusmenuproxy.desktop
  gmenu-dbusmenu-proxy/main.cpp
  gmenu-dbusmenu-proxy/menu.cpp
  gmenu-dbusmenu-proxy/menu.h
  gmenu-dbusmenu-proxy/menuproxy.cpp
  gmenu-dbusmenu-proxy/menuproxy.h

To: broulik, #plasma
Cc: mtallur, ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, 
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart