Moving/resizing a window in real-time

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Moving/resizing a window in real-time

Alexander Magsam
Hello all,


I am creating a program that uses face detection coordinates to move/resize a window in real-time. The GTK+ component of this program is fairly simple I believe, but I cannot seem to figure out what is going wrong. I would like the window to stay visible the entire time without having to call "gtk_main_iteration".


I have posted this question with more detail at https://stackoverflow.com/questions/45151465/move-gtk-window-in-real-time for you all to see.


I am trying to model this after OpenCV's "moveWindow" function, which uses GTK+ and the same "gtk_window_move" function that I am using. If you are interested in comparing my code to the OpenCV source code you can find these at https://github.com/opencv/opencv/tree/master/modules/highgui/src under window.cpp and window_gtk.cpp.


This project is at a standstill because of this issue so any insight is appreciated!


-Alex

[https://avatars1.githubusercontent.com/u/5009934?v=3&s=400]<https://github.com/opencv/opencv/tree/master/modules/highgui/src>

opencv/modules/highgui/src at master · opencv/opencv · GitHub<https://github.com/opencv/opencv/tree/master/modules/highgui/src>
github.com
opencv - Open Source Computer Vision Library ... You signed in with another tab or window. Reload to refresh your session.


_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Moving/resizing a window in real-time

Gtk+ - Apps Dev mailing list

 
Hi Alex,

The OpenCV window_gtk.cpp isn't so simple. A lot of tough concepts there. For example the code is written for compiling with both GTK2 and GTK3, makes use of threads, creates a custom GTK widget, uses GTK OpenGL if it can, etc.

The GTK functions can only be called on the "main" thread of the program. This means that the OpenCV drawing can happen on a worker thread and you can keep track of the worker thread progress with the use of locking. When OpenCV is done you can notify the GTK main loop it is done and update the window. The following shows how something like this might work in a little simpler program.

https://github.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/mandelbrot1.c

Have you made custom widgets with GTK? You can incorporate threads and the functionality that you are looking for and build it into a widget. There is an experimental gauge widget that draws on a separate thread at the following. That way the gauge drawing only gets redrawn entirely when the window gets resized. Speeds things up when using a frame clock and multiple gauges. Causes some screen flicker though on resizes.

https://github.com/cecashon/OrderedSetVelociRaptor/tree/master/Misc/AdjustableGauge2

For real-time or smooth window moves you can use a frame clock or a timer to check if you need to move your window. A lot of options to build what you want.

Eric

 


_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Loading...