Difference between GtkWindow and GdkWindow?

前端 未结 2 1972
南方客
南方客 2020-12-15 09:05

At the beginning of my Gtk-Gdk-Cairo-Pango app, I create the window:

GtkWidget   *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

First, there

2条回答
  •  一个人的身影
    2020-12-15 10:07

    There's so many questions in there that I'm not going to try answering all.

    About latency of drawing: most likely option is that there's a bug or unoptimized code in your implementation: the draw cycle is quite unique in application code in that it really, really needs to be fast...

    Things to note:

    • you call gtk_widget_queue_draw(window) from your draw-event handler: that seems unnecessary
    • you always redraw on a mouse event without checking if it's really necessary (possibly you do want to queue draw on all motion events: please make sure of that though)
    • you always redraw the whole widget: this can be very expensive and you shouldn't do it if you only need to change a small area at a time and are doing frequent redraws like you are. See gtk_widget_queue_draw_region ().
    • drawing text can be expensive: I'm not familiar with the functions you use but you may want to start with just drawing a box or something to see where the problem is

提交回复
热议问题