gtk

How to style a GtkLabel with CSS?

夙愿已清 提交于 2019-12-18 13:27:18
问题 I'm trying to use CSS to style a GtkLabel. I would like to change the color and font size of the label. Here is my C code: #include <gtk/gtk.h> int main(int argc, char *argv[]) { gtk_init(&argc, &argv); GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget *label = gtk_label_new("Label"); GtkCssProvider *cssProvider = gtk_css_provider_new(); gtk_css_provider_load_from_path(cssProvider, "theme.css", NULL); gtk_style_context_add_provider(gtk_widget_get_style_context(window), GTK

How does GUI output work from application to hardware level?

大城市里の小女人 提交于 2019-12-18 12:27:45
问题 I am getting into GUI programming and did some research. Now not everything is clear to me. If I would use GTK+ as toolkit, how does it communicate with the graphics card? On a Linux system I suppose it would be GTK --> X Server --(OpenGL)--> graphics card. Is this right? I read that some GUIs directly draw OpenGL (e.g. Blender3D), so how do other apps draw their GUIs? If the only APIs (that i know of) for graphics cards is Direct3D and OpenGL, what is the distinction between software

Compiling C/GTK within Eclipse

為{幸葍}努か 提交于 2019-12-18 11:58:01
问题 I'm fiddling around with the C/C++ version of Eclipse to build a simple GTK app. However, I can't seem to be able to compile a GTK sample from within Eclipse. I can compile a simple Hello World style test app, so I know the tool chain itself is working. However, the moment I start adding GTK into the mix the compiler comes up with errors. The funny thing is that I can compile the examples outside the Eclipse environment just fine. E.g., I'm using the examples on this page and following the

Taking a screenshot with C\GTK

自古美人都是妖i 提交于 2019-12-18 11:14:02
问题 I'm trying to take a screenshot of the entire screen with C and GTK. I don't want to make a call to an external application for speed reasons. I've found Python code for this (Take a screenshot via a python script. [Linux]); I just need to figure out how to do that in C. 回答1: After looking at the GNOME-Screenshot code and a Python example, I came up with this: GdkPixbuf * get_screenshot(){ GdkPixbuf *screenshot; GdkWindow *root_window; gint x_orig, y_orig; gint width, height; root_window =

How to debug WebKit2GTK+ extensions

随声附和 提交于 2019-12-18 09:37:14
问题 I am trying to get WebKit2GTK+ Extensions to work, it is a simple extension that will just print into the console when a page is created. Here is my project structure: -bin -images -include -lib --webextension ---libwebextension.so ---libwebextension.so.1 ---libwebextension.so.1.0 ---webextension.cpp -src --gtk ---gtk_manager.cpp --main.cpp The gtk_manager.cpp files contains the implementation of the header file, only the init() function will matter (will get to that in a little bit)

Compiling a GTK3 program in Visual Studio 2012

拜拜、爱过 提交于 2019-12-18 07:18:32
问题 With the release of Gtk 3 for windows I thought of upgrading my Gtk 2 C application to take advantage of the new GtkGrid widget. The program compiles fine under linux or using MinGW (with codeblocks) under windows, however when I try the same set of files under Visual Studio 2012, giving me 50 or so compilation errors saying gutils.h, gtrashstack.h and gstring.h have a bunch of syntax errors (assuming I only use a basic program, with just a gtk_init and gtk_main). Visual Studio handled gtk2

Gtk2hs windows 7 installation

[亡魂溺海] 提交于 2019-12-18 07:08:56
问题 I did: cabal update cabal install gtk2hs-buildtools But stuck here: >cabal install gtk Resolving dependencies... [1 of 2] Compiling SetupWrapper ( C:\Users\1\AppData\Local\Temp\gtk-0.12.5.4 -4000\gtk-0.12.5.4\SetupWrapper.hs, C:\Users\1\AppData\Local\Temp\gtk-0.12.5.4-4 000\gtk-0.12.5.4\dist\setup\SetupWrapper.o ) [2 of 2] Compiling Main ( C:\Users\1\AppData\Local\Temp\gtk-0.12.5.4 -4000\gtk-0.12.5.4\Setup.hs, C:\Users\1\AppData\Local\Temp\gtk-0.12.5.4-4000\gtk -0.12.5.4\dist\setup\Main.o )

HOWTO: Idiomatic Rust for callbacks with gtk (rust-gnome)

回眸只為那壹抹淺笑 提交于 2019-12-18 05:45:07
问题 I am currently learning Rust and looking to use it for developing a GUI based application with GTK+. My problem relates to registering callbacks to respond to GTK events/signals and mutating state within those callbacks. I have a working but inelegant solution, so I would like to ask if there is a cleaner, more idiomatic solution. I have implemented my code as a struct with method implementations, where the struct maintains references to the GTK widgets along with other state that it needs.

how to compile gtk+ application for native windows (and not for X windows)?

好久不见. 提交于 2019-12-18 05:11:22
问题 I have managed to compile a gtk+ application with cygwin, but unfortunately with this approach, the application needs x windows running to be able to startup. How can I compile my gtk+ application to run natively on windows. I have seen various posts online about using the -mno-cygwin flag to gcc , but that seems to have been deprecated? I have also seen these posts on stackoverflow, but its not clear if they are trying to compile for X, or natively for Windows: Installing gtk and compiling

How to draw any GTK widget on top of Cairo surface

删除回忆录丶 提交于 2019-12-18 04:39:15
问题 I would like to save the looks of a GTK window, and all the buttons and other widgets it contains to a PNG or PDF file. Cairo supports drawing on such surfaces. Could I somehow ask a GTK widget to draw itself on Cairo surface? A code sample would be much appreciated, since I am a newcomer to both GTK and Cairo. Python is my language of choice. 回答1: In C, you can put your buttons and widgets in a GtkOffscreenWindow using gtk_widget_reparent() and then use gtk_offscreen_window_get_pixbuf() to