Popup menus with Gtk::MozEmbed?


#1

Hi

I’m trying to add right-click context menus to a Gtk::MozEmbed widget,
but
found that the usual ‘popup-menu’ and ‘button-press-event’ don’t get
fired.
After some searching I discovered an undocumented ‘dom_mouse_down’
event,
which works but unfortunately only returns a GLib::Pointer as argument.

Is there a way to convert this pointer to a real Gdk::Event, or some
other
way to find out if the right button was pressed? Also, I’d like to check
if the mouse was clicked over a link, I guess this info is also included
in that pointer. Did anybody find out how to do this?

Thanks,
Markus


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


#2

Hi

Markus K. wrote:

Hi

I’m trying to add right-click context menus to a Gtk::MozEmbed widget, but
found that the usual ‘popup-menu’ and ‘button-press-event’ don’t get fired.
After some searching I discovered an undocumented ‘dom_mouse_down’ event,
which works but unfortunately only returns a GLib::Pointer as argument.

I see this event in the source code, but it’s not documented and as such
i’m
not sure if it’s safe to implement in the binding.

Is there a way to convert this pointer to a real Gdk::Event, or some other
way to find out if the right button was pressed? Also, I’d like to check
if the mouse was clicked over a link, I guess this info is also included
in that pointer. Did anybody find out how to do this?

I think this should be done in the binding (like
set_on_new_window_block/clear_on_new_window_block), but one must first
know
what kind of data this pointer points to.


Mirko M.


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


#3

On Sun, Jan 21, 2007 at 07:01:53PM +0100, Mirko M. wrote:

I think this should be done in the binding (like
set_on_new_window_block/clear_on_new_window_block), but one must first know
what kind of data this pointer points to.

I poked a little around the gtkmozembed source, and found the relevant
parts. The signal gets raised in
http://lxr.mozilla.org/seamonkey/source/embedding/browser/gtk/src/EmbedEventListener.cpp#295,
and the passed pointer is a nsIDOMMouseEvent, which is defined in
http://lxr.mozilla.org/seamonkey/source/dom/public/idl/events/nsIDOMMouseEvent.idl.
One of the fields is a nsIDOMEventTarget, which I suppose describes the
DOM element which received the click.

Now, I don’t know how hard it would be to implement this in the binding,
as I have absolutely no experience with either C++ or the Mozilla
codebase.
But maybe someone else wants to give it a shot?

Cheers,
Markus


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


#4

Hi Markus,

Markus K. wrote:

One of the fields is a nsIDOMEventTarget, which I suppose describes the
DOM element which received the click.

Thank you for your pointers. This is mozilla C++ code not wrapped by
gtkmozembed.

I think that starting from the Event there is no end to the chain of the
C++
data structures involved.

Now, I don’t know how hard it would be to implement this in the binding,
as I have absolutely no experience with either C++ or the Mozilla codebase.
But maybe someone else wants to give it a shot?

I think that this has to be implemented in the gtkmozembed C code before
it
can find its way into the ruby binding. There is no C++ code in
ruby-gnome2
afaik. Masao? Do you think we might introduce some C++ in the binding to
support this undocumented feature of gtkmozembed?

Mirko


Mirko M.


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


#5

Markus K. wrote:

On Mon, Jan 22, 2007 at 02:23:03PM +0100, Mirko M. wrote:
… I remember some module in the Pickaxe which
allows you to convert C structures into pure Ruby objects by describing the
sizes of the individual fields. Would this also be possible with C++? I guess
this solution wouldn’t be clean enough for the binding, but maybe it would work
fine in my application.

If i remember correctly, unlike a C structure, a C++ class can not be
unpacked in any safe way. You can eventually access the data you need
but
there is no guarantee that it will work if mozilla is compiled with
another
C++ compiler.


Mirko M.


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


#6

Mirko M. wrote:

Markus K. wrote:

On Mon, Jan 22, 2007 at 02:23:03PM +0100, Mirko M. wrote:
… I remember some module in the Pickaxe which
allows you to convert C structures into pure Ruby objects by describing the
sizes of the individual fields. Would this also be possible with C++? I guess
this solution wouldn’t be clean enough for the binding, but maybe it would work
fine in my application.

If i remember correctly, unlike a C structure, a C++ class can not be
unpacked in any safe way.

But i may be wrong. C++ mangles function names, but C++ structure are
compatible with C structures.

I’ve not tried this but you can try to make gtkmozembed unsensitive and
put
it in an event box… just a try.


Mirko M.
Ubuntu: an African word meaning “I can’t figure out how to configure
Debian”


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


#7

On Mon, Jan 22, 2007 at 02:23:03PM +0100, Mirko M. wrote:

Thank you for your pointers. This is mozilla C++ code not wrapped by
gtkmozembed.

I think that starting from the Event there is no end to the chain of the C++
data structures involved.

Hmm… I had a feeling this would be the case :wink:

I think that this has to be implemented in the gtkmozembed C code before it
can find its way into the ruby binding. There is no C++ code in ruby-gnome2
afaik. Masao? Do you think we might introduce some C++ in the binding to
support this undocumented feature of gtkmozembed?

It would be really worthwile, as a browser without a context menu is a
bit lame.
On the other hand, it looks like it needs a lot of effort, so maybe
there’s
another way to get at the data? I remember some module in the Pickaxe
which
allows you to convert C structures into pure Ruby objects by describing
the
sizes of the individual fields. Would this also be possible with C++? I
guess
this solution wouldn’t be clean enough for the binding, but maybe it
would work
fine in my application.

Mirko

Anyway, thanks for your help!

Markus


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


#8

On Thu, Jan 25, 2007 at 09:17:27AM +0100, Mirko M. wrote:

Mirko M. wrote:

But i may be wrong. C++ mangles function names, but C++ structure are
compatible with C structures.

Ok, then I’ll have a look at that module…

I’ve not tried this but you can try to make gtkmozembed unsensitive and put
it in an event box… just a try.

Unfortunately if I set it to unsensitive, it doesn’t receive any events,
so
I can’t click on links etc.

But thanks for your help, anyway!

Cheers,
Markus


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV