Re: GdkScreen size-changed and gdk_monitor_get_workarea problem

2018-11-16 Thread Sebastian Geiger (Lanoxx)
Hi Florian,

On 8/11/18 1:41 pm, Florian Müllner wrote:
> On Thu, Nov 8, 2018 at 12:35 PM Sebastian Geiger (Lanoxx)
>  wrote:
>>
>> I was able to resolve the issue yesterday, and found that it was not
>> directly a Problem of GTK+.
> 
> To some extent it is, I don't think its API currently allows what you
> are trying to do.
> 
> On X11, the WM is a client like your app as far as screen changes are
> concerned. It will update the _NET_WORKAREA property in response to
> the size change, but I don't see how it would be possible to ensure
> that the property is written before the server notifies other clients
> about the size change. But let's assume that this was possible and
> fixed. It would still be possible for your app to get the wrong work
> area, because the area can change without a change in screen size (for
> example a dock or panel that is shown or removed).
> 
> So if this is something GTK+ wants to support, then I think the best
> option would be to emit change notifications for GdkMonitor:workarea.

You are right. I was ignoring the fact that the workarea needs to be
computed by the window manager after the monitor geometry has changed
and of course that cannot happen in the same event cycle as the event
for the monitor change itself.

I am not sure how much overhead it would cause in Gtk to emit change
events for GdkMonitor:workarea and if that is something Gtk wants to
monitor, but if such a notification was added that would certainly be
useful for me.

Thanks for your the explanation.

> 
> Cheers,
> Florian
> 
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


How to set style in a GTK+ 2 widget's realize function?

2018-11-16 Thread Brent W. Baccala
Hi -

I've got a GTK+ 2 "external" widget (gtkdatabox from gtkdatabox.sf.net)
that isn't displaying right after I've patched it to compile with
GSEAL_ENABLED.

The relevant code in the older version was:

widget->style = gtk_style_attach (widget->style, widget->window);


which we changed to:

gtk_widget_set_style (widget, gtk_style_attach (gtk_widget_get_style
(widget), window));


...and now the background color doesn't display right on an application
(xoscope from xoscope.sf.net) that loads style from an "rc" file using
gtk_rc_parse().

I don't understand GTK+ internals well enough to understand why.  If I take
this line of code out completely, the background displays correctly, but
colored lines in other applications (the gtkdatabox examples) don't display.

The solution I've got at the moment (other than convert the entire widget
library and application to GTK+ 3) is to compile the widget without
GSEAL_ENABLED and go back to the older code.

Can somebody who knows GTK+ 2 well help me out?  Any idea what's causing
this and how to fix it?

Thanks.

agape
brent
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


compile error in GNOME Builder 3.22.4 https://developer.gnome.org/gtk3/3.24/ch01s02.html

2018-11-16 Thread Krzysztof Sadowski via gtk-devel-list
build error in gtk with doc in Builder
it seems that I see the problem of the change I have made below


#include 

static void
print_hello (GtkWidget *widget,
 gpointer   data)
{
  g_print ("Hello World\n");
}

static void
activate (GtkApplication *app,
  gpointeruser_data)
{
  GtkWidget *window;
  GtkWidget *grid;
  GtkWidget *button;

  /* utwórz nowe okno i ustaw jego tytuł */
  window = gtk_application_window_new (app);
  gtk_window_set_title (GTK_WINDOW (window), "Window");
  gtk_container_set_border_width (GTK_CONTAINER (window), 10);

  /* Tutaj skonstruujemy kontener, który będzie pakował nasze guziki */
  grid = gtk_grid_new ();

  /* Zapakuj pojemnik w okno */
  gtk_container_add (GTK_CONTAINER (window), grid);

  button = gtk_button_new_with_label ("Button 1");
  g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);

  /* Umieść pierwszy przycisk w komórce siatki (0, 0) i wypełnij go
   * tylko 1 komórka poziomo i pionowo (tzn. bez rozpiętości)
   */
  gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1);

  button = gtk_button_new_with_label ("Button 2");
  g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);

  /* Umieść drugi przycisk w komórce siatki (1, 0) i wypełnij go
   * tylko 1 komórka poziomo i pionowo (tzn. bez rozpiętości)
   */
  gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 2, 1);

  button = gtk_button_new_with_label ("Quit");
  g_signal_connect_swapped (button, "clicked", G_CALLBACK
(gtk_widget_destroy), window);

  /* Umieść przycisk Zakończ w komórce siatki (0, 1) i ustaw go
   * rozpiętość 2 kolumn.
   */
  gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 3, 1);

  /* Teraz, gdy skończyliśmy pakować nasze widżety, pokazujemy je wszystkie
   * za jednym zamachem, przez wywołanie gtk_widget_show_all () w oknie.
   * To wywołanie rekursywnie wywołuje gtk_widget_show () we wszystkich
widżetach
   * które są zawarte w oknie, bezpośrednio lub pośrednio.
   */
  gtk_widget_show_all (window);

}

int
main (intargc,
  char **argv)
{
  GtkApplication *app;
  int status;

  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
  status = g_application_run (G_APPLICATION (app), argc, argv);
  g_object_unref (app);

  return status;
}

Krzysztof Sadowski
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: How to set style in a GTK+ 2 widget's realize function?

2018-11-16 Thread Paul Davis
I can't answer your question. But I can say that we never use gtk_style*.
Instead we just parse the RC file that includes "widget/style"
associations, and then we use gtk_widget_set_name() on our widgets to get
them to use the right style.

On Fri, Nov 16, 2018 at 5:32 AM Brent W. Baccala 
wrote:

> Hi -
>
> I've got a GTK+ 2 "external" widget (gtkdatabox from gtkdatabox.sf.net)
> that isn't displaying right after I've patched it to compile with
> GSEAL_ENABLED.
>
> The relevant code in the older version was:
>
> widget->style = gtk_style_attach (widget->style, widget->window);
>
>
> which we changed to:
>
> gtk_widget_set_style (widget, gtk_style_attach (gtk_widget_get_style
> (widget), window));
>
>
> ...and now the background color doesn't display right on an application
> (xoscope from xoscope.sf.net) that loads style from an "rc" file using
> gtk_rc_parse().
>
> I don't understand GTK+ internals well enough to understand why.  If I
> take this line of code out completely, the background displays correctly,
> but colored lines in other applications (the gtkdatabox examples) don't
> display.
>
> The solution I've got at the moment (other than convert the entire widget
> library and application to GTK+ 3) is to compile the widget without
> GSEAL_ENABLED and go back to the older code.
>
> Can somebody who knows GTK+ 2 well help me out?  Any idea what's causing
> this and how to fix it?
>
> Thanks.
>
> agape
> brent
>
>
> ___
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-devel-list
>
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list