Re: gtk-devel-list Digest, Vol 60, Issue 24

2009-04-17 Thread Ravi Kasibhatla
Hi Christian,

Thanks for the reply.  The exact problem I am facing is the destruction of
the Socket & Plug widgets.
Currently what I am doing is:
- While creating the plugin, I am creating the plug using gtk_plug_new(). I
am adding my plugin windows & controls to the plug.
- At the time of deletion of plugin, I am freeing all the resources
allocated during the usage of plugin.
- At this time, I am calling for gtk_widget_destroy(plug).
- The problem is at this point. After the last step, the plug is destroyed,
but what about the socket created for holding this plug? I am catching the
"plug-removed" signal, but that callback is never getting called.

As a result, according to me, the socket created is getting accumulated. So,
if I open 5 plugins, I am accumulating (leaking) 5 socket widgets. So, I
wanted to know, whether there is any special way of deleting the plug, so
that "plug-removed" signal is automatically invoked. Also, how do we destroy
socket by calling gtk_widget_destroy(socket) call?

I was going through gtk+ code and I found there are functions
"_gtk_plug_remove_from_socket()" & "gtk_plug_get_socket_window()". Can I use
these functions as I didnt found these functions reference anywhere in Gtk
documentation? If I can, should I use these functions to complete the
destruction process? Please let me the exact protocol.

Thanks in advance,
Ravi Phaneendra K

Message: 1
> Date: Wed, 15 Apr 2009 00:19:38 +0530
> From: Ravi Kasibhatla 
> Subject: Unplugging GtkPlug from GtkSocket
> To: gtk-devel-list@gnome.org
> Message-ID:
><1a8a91a70904141149x55a73032rfe8acaa40f375...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
>
> I am creating a plugin for a browser based on webkit, using the xembed
> protocol i.e. using GtkSocket & GtkPlug. I have been successfully able to
> create the plugin & show the content required on the plugin window, but I
> am
> facing problem when I try to delete the plugin. At the time of deletion of
> plugin, I want to delete the plug created, so as to free the resources
> allocated to the plug while creating plugin. Can anyone tell me how to do
> it, including how to do the cleanup on the GtkSocket side created in the
> browser?
>
> It would be of great help if anyone could let me know on this ASAP, as I am
> in urgent need of this information. I tried to find any resource telling
> more on XEmbed protocol usage and the cleanup process when using XEmbed
> protocol on the web, but couldn't get anything concrete help on this topic.
>
> Thanks & Regards,
> Ravi Phaneendra K
> -- next part --
> An HTML attachment was scrubbed...
> URL: <
> http://mail.gnome.org/archives/gtk-devel-list/attachments/20090415/b049cf81/attachment.html
> >
>
> --
>
> Message: 2
> Date: Wed, 15 Apr 2009 01:59:32 +0200
> From: Christian Dywan 
> Subject: Re: Unplugging GtkPlug from GtkSocket
> To: gtk-devel-list@gnome.org
> Message-ID: <20090415015932.225cb...@imendio.com>
> Content-Type: text/plain; charset=US-ASCII
>
> Am Wed, 15 Apr 2009 00:19:38 +0530
> schrieb Ravi Kasibhatla :
>
> > Hi all,
> >
> > I am creating a plugin for a browser based on webkit, using the xembed
> > protocol i.e. using GtkSocket & GtkPlug. I have been successfully
> > able to create the plugin & show the content required on the plugin
> > window, but I am facing problem when I try to delete the plugin. At
> > the time of deletion of plugin, I want to delete the plug created, so
> > as to free the resources allocated to the plug while creating plugin.
> > Can anyone tell me how to do it, including how to do the cleanup on
> > the GtkSocket side created in the browser?
> >
> > It would be of great help if anyone could let me know on this ASAP,
> > as I am in urgent need of this information. I tried to find any
> > resource telling more on XEmbed protocol usage and the cleanup
> > process when using XEmbed protocol on the web, but couldn't get
> > anything concrete help on this topic.
> >
> > Thanks & Regards,
> > Ravi Phaneendra K
>
> Hey Ravi,
>
> so what problem are you facing exactly? From what I understand you have
> an nsplugin that creates a socket and loads a plug from somewhere.
> Please correct me if I misunderstand the scenario. And I assume you are
> in charge of the socket and plug code. So both are GtkWidgets which
> have the usual finalize, dispose and destroy, plus the "plug-removed"
> signal on GtkSocket.
>
> I haven't used this in a while since it is somewhat messy, so it would
> be good if you could provide more context about what you are doing and
> what is not working.
>
> Yours,
>Christian
>
>
> --
>
> ___
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
>
>
> End of gtk-devel-list Digest, Vol 60, Issue 24
> **
>
__

Re: Unplugging GtkPlug from GtkSocket

2009-04-17 Thread Ravi Kasibhatla
Sorry, forgot to change the subject line last time.

Hi Christian,

Thanks for the reply.  The exact problem I am facing is the destruction of
the Socket & Plug widgets.
Currently what I am doing is:
- While creating the plugin, I am creating the plug using gtk_plug_new(). I
am adding my plugin windows & controls to the plug.
- At the time of deletion of plugin, I am freeing all the resources
allocated during the usage of plugin.
- At this time, I am calling for gtk_widget_destroy(plug).
- The problem is at this point. After the last step, the plug is destroyed,
but what about the socket created for holding this plug? I am catching the
"plug-removed" signal, but that callback is never getting called.

As a result, according to me, the socket created is getting accumulated. So,
if I open 5 plugins, I am accumulating (leaking) 5 socket widgets. So, I
wanted to know, whether there is any special way of deleting the plug, so
that "plug-removed" signal is automatically invoked. Also, how do we destroy
socket by calling gtk_widget_destroy(socket) call?

I was going through gtk+ code and I found there are functions
"_gtk_plug_remove_from_socket()" & "gtk_plug_get_socket_window()". Can I use
these functions as I didnt found these functions reference anywhere in Gtk
documentation? If I can, should I use these functions to complete the
destruction process? Please let me the exact protocol.

Thanks in advance,
Ravi Phaneendra K


On Wed, Apr 15, 2009 at 5:30 PM,  wrote:

> Send gtk-devel-list mailing list submissions to
>gtk-devel-list@gnome.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> or, via email, send a message with subject or body 'help' to
>gtk-devel-list-requ...@gnome.org
>
> You can reach the person managing the list at
>gtk-devel-list-ow...@gnome.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gtk-devel-list digest..."
>
>
> Today's Topics:
>
>   1. Unplugging GtkPlug from GtkSocket (Ravi Kasibhatla)
>   2. Re: Unplugging GtkPlug from GtkSocket (Christian Dywan)
>
>
> --
>
> Message: 1
> Date: Wed, 15 Apr 2009 00:19:38 +0530
> From: Ravi Kasibhatla 
> Subject: Unplugging GtkPlug from GtkSocket
> To: gtk-devel-list@gnome.org
> Message-ID:
><1a8a91a70904141149x55a73032rfe8acaa40f375...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
>
> I am creating a plugin for a browser based on webkit, using the xembed
> protocol i.e. using GtkSocket & GtkPlug. I have been successfully able to
> create the plugin & show the content required on the plugin window, but I
> am
> facing problem when I try to delete the plugin. At the time of deletion of
> plugin, I want to delete the plug created, so as to free the resources
> allocated to the plug while creating plugin. Can anyone tell me how to do
> it, including how to do the cleanup on the GtkSocket side created in the
> browser?
>
> It would be of great help if anyone could let me know on this ASAP, as I am
> in urgent need of this information. I tried to find any resource telling
> more on XEmbed protocol usage and the cleanup process when using XEmbed
> protocol on the web, but couldn't get anything concrete help on this topic.
>
> Thanks & Regards,
> Ravi Phaneendra K
> -- next part --
> An HTML attachment was scrubbed...
> URL: <
> http://mail.gnome.org/archives/gtk-devel-list/attachments/20090415/b049cf81/attachment.html
> >
>
> --
>
> Message: 2
> Date: Wed, 15 Apr 2009 01:59:32 +0200
> From: Christian Dywan 
> Subject: Re: Unplugging GtkPlug from GtkSocket
> To: gtk-devel-list@gnome.org
> Message-ID: <20090415015932.225cb...@imendio.com>
> Content-Type: text/plain; charset=US-ASCII
>
> Am Wed, 15 Apr 2009 00:19:38 +0530
> schrieb Ravi Kasibhatla :
>
> > Hi all,
> >
> > I am creating a plugin for a browser based on webkit, using the xembed
> > protocol i.e. using GtkSocket & GtkPlug. I have been successfully
> > able to create the plugin & show the content required on the plugin
> > window, but I am facing problem when I try to delete the plugin. At
> > the time of deletion of plugin, I want to delete the plug created, so
> > as to free the resources allocated to the plug while creating plugin.
> > Can anyone tell me how to do it, including how to do the cleanup on
> > the GtkSocket side created in the browser?
> >
> > It would be of great help if anyone could let me know on this ASAP,
> > as I am in urgent need of this information. I tried to find any
> > resource telling more on XEmbed protocol usage and the cleanup
> > process when using XEmbed protocol on the web, but couldn't get
> > anything concrete help on this topic.
> >
> > Thanks & Regards,
> > Ravi Phaneendra K
>
> Hey Ravi,
>
> so what problem are you facing exactly? From what I understand y

gtk_widget_get_allocation

2009-04-17 Thread Cody Russell
On Thu, 2008-09-25 at 02:02 +0200, Christian Dywan wrote:
> >  * gtk_widget_get_allocation
> >Removed in 2.14.1
> 
> The prototype of this function was not agreed upon among the core
> developers. So the decision was deferred to the next Gtk version.
> It had to be removed before final API freeze, otherwise it could not
> have been changed anymore.

This is rather old, but it never came up again after this so I'd like to
see what thoughts are about how to implement this in C.  It was in 2.13
but removed before 2.14 because of disagreement, but I can't find any
public record of the disagreement in gtk-devel-list.  Can anyone comment
on what was not liked, or how a better implementation could be made?

For reference, this is the previous implementation:

GtkAllocation
gtk_widget_get_allocation (GtkWidget *widget)
{
  static GtkAllocation allocation = { 0 };
  g_return_val_if_fail (GTK_IS_WIDGET (widget), allocation);

  return widget->allocation;
}

/ Cody

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: gtk_widget_get_allocation

2009-04-17 Thread Brian J. Tarricone

Cody Russell wrote:

On Thu, 2008-09-25 at 02:02 +0200, Christian Dywan wrote:

 * gtk_widget_get_allocation
   Removed in 2.14.1

The prototype of this function was not agreed upon among the core
developers. So the decision was deferred to the next Gtk version.
It had to be removed before final API freeze, otherwise it could not
have been changed anymore.


This is rather old, but it never came up again after this so I'd like to
see what thoughts are about how to implement this in C.  It was in 2.13
but removed before 2.14 because of disagreement, but I can't find any
public record of the disagreement in gtk-devel-list.  Can anyone comment
on what was not liked, or how a better implementation could be made?

For reference, this is the previous implementation:

GtkAllocation
gtk_widget_get_allocation (GtkWidget *widget)
{
  static GtkAllocation allocation = { 0 };
  g_return_val_if_fail (GTK_IS_WIDGET (widget), allocation);

  return widget->allocation;
}


I assume the issue was with returning a non-primitive type by-value and 
not as a pointer.  For modern compilers this isn't a big deal, I don't 
think (but might be inefficient on some arches), but I imagine people 
want to compile gtk on all sorts of systems.  An implementation like 
this avoids that problem, though perhaps isn't as nice to use[1]:


void
gtk_widget_get_allocation (GtkWidget *widget,
   GtkAllocation *allocation)
{
g_return_if_fail (GTK_IS_WIDGET (widget) && allocation);

memcpy (allocation, &widget->allocation, sizeof(*allocation));
}

(Could also have it return gboolean, but I tend to think it's 
unnecessary to have a success/fail return value when the only reason it 
would fail is if the programmer is using the function incorrectly.)


This seems to be a similar pattern to how other things like this are 
done in gtk...


-brian

[1] I guess part of the motivation for the original (rejected) 
implementation is so that you can do things like this:


gint width = gtk_widget_get_allocation (widget).width;

Oh well.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: gtk_widget_get_allocation

2009-04-17 Thread Havoc Pennington
Hi,

On Fri, Apr 17, 2009 at 9:38 PM, Brian J. Tarricone  wrote:
> I assume the issue was with returning a non-primitive type by-value and not
> as a pointer.

Right. The normal way in glib/gtk would definitely be as you say.

> void
> gtk_widget_get_allocation (GtkWidget     *widget,
>                           GtkAllocation *allocation)
> {
>    g_return_if_fail (GTK_IS_WIDGET (widget) && allocation);

but this should be two separate checks

>    memcpy (allocation, &widget->allocation, sizeof(*allocation));

and just:
 *allocation = widget->allocation;

should be fine.

Presumably some core gtk dev was arguing for the weird way though or
someone would have just fixed it ;-)

Havoc
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: gtk_widget_get_allocation

2009-04-17 Thread Hubert Figuiere

On 04/17/2009 09:38 PM, Brian J. Tarricone wrote:

void
gtk_widget_get_allocation (GtkWidget *widget,
GtkAllocation *allocation)
{
 g_return_if_fail (GTK_IS_WIDGET (widget) && allocation);

 memcpy (allocation, &widget->allocation, sizeof(*allocation));
}

(Could also have it return gboolean, but I tend to think it's
unnecessary to have a success/fail return value when the only reason it
would fail is if the programmer is using the function incorrectly.)


I don't think it needs a boolean given the condition. Previously it was 
being accessed by dereferencing the struct field.


So as you say the only it would fail it because it is used incorrectly. 
In that case, it wouldn't crash, unlike before when accessing the struct 
fields.



Hub
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: gtk_widget_get_allocation

2009-04-17 Thread Hubert Figuiere

On 04/17/2009 09:02 PM, Cody Russell wrote:

This is rather old, but it never came up again after this so I'd like to
see what thoughts are about how to implement this in C.  It was in 2.13
but removed before 2.14 because of disagreement, but I can't find any
public record of the disagreement in gtk-devel-list.  Can anyone comment
on what was not liked, or how a better implementation could be made?


It should be noted that this one was a major showstopper for me to build 
AbiWord with GSEAL enabled. And the more we wait to have this implement, 
the more it will be a problem.
Currently some "basic" accessor (gtk_widget_get_window() for example) 
are only in Gtk 2.14. This is already a big issue to write code that 
work with GSEAL and still work with earlier version of Gtk. Gtk 2.14 is 
still not that common even more on "Enterprise" distributions.


I know there are some hack that can be done (been there, done that), but 
still. And today everything that touch "flags" or "allocation" is a no go.



Hub
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


GTK+ branched

2009-04-17 Thread Matthias Clasen
I've just created a stable gtk-2-16 branch.
Future 2.16.x releases will be made off that branch, while development
towards 2.18 proceeds on master.

Matthias
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list