Re: Accessing MetaWindow.get_xwindow from js



Hi Matthijs,

Yes, when it has `introspectable="0"` then you can't call it using GIR bindings from JS.
I found it useful to generate the documentation for Mutter from the gir - see this (you need g-ir-doc-tool) [0[
What do you want the xwindow for? Back when I wrote the Maximus extension (quite out of date now) I needed to get the X ID of the window so I could undecorate it and neither the X ID or the undecoration were exposed in the Mutter bindings, so I ended up forking out to xwininfo/xprop to do the job [1]. Depending on what you need the xwindow for, perhaps xwininfo/xprop could work for you.

Also if you have the wnck gir there are a bunch of methods exposed there that are not exposed in Mutter (for example at the time of writing the Window Options extension[2], also very out of date, the always_on_top ability was exposed in Wnck but not in Mutter: it was exposed in Mutter from 3.6 onwards though), so perhaps that could be another way to do what you want.

You can find wnck documentation here[3]

[0]: http://worldofgnome.org/how-to-generate-native-gjs-docs/
[1]: https://bitbucket.org/mathematicalcoffee/maximus-gnome-shell-extension/src/e0ee4366f832b7b26a269ce7183df457602f4ff9/maximus mathematical coffee gmail com/extension.js?at=default#cl-162
[2]: https://bitbucket.org/mathematicalcoffee/window-options-gnome-shell-extension/src/ba352408fbd05b51b1b25e95e2e6edc1159cb961/window-options mathematical coffee gmail com/extension.js?at=default
[3]: https://developer.gnome.org/libwnck/stable/

cheers
Amy

On 29 September 2014 21:21, Matthijs Kooijman <matthijs stdin nl> wrote:
Hey folks,

after digging around with extension js code for a while, I found
that a lot of the native API is "documented" in gir files. In
particular, I was looking at /usr/lib/mutter/Meta-3.0.gir here.

However, I couldn't manage to access the get_xwindow method on the
MetaWindow class. In the gir file, it says:

      <method name="get_xwindow"
              c:identifier="meta_window_get_xwindow"
              introspectable="0">
        <return-value transfer-ownership="none">
          <type name="xlib.Window" c:type="Window"/>
        </return-value>
        <parameters>
          <instance-parameter name="window" transfer-ownership="none">
            <doc xml:space="preserve">a #MetaWindow</doc>
            <type name="Window" c:type="MetaWindow*"/>
          </instance-parameter>
        </parameters>
      </method>

However, when I run this in the looking glass, it gives an "is not a function"
error.

        win = global.get_window_actors()[0].metaWindow;
        win.get_xwindow();

I suspect this is related to the introspectable="0" attribute, but I can't quite figure out how this works.

It seems essentially the same question was asked on the gtk list two
years ago, with no replies. http://marc.info/?l=gtk&m=133003907121583&w=2

Any idea?

Gr.

Matthijs

_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]