Drawing directly to the screen via GTK or GDK - c

I am working on a demo application for a library me and two colleagues are writing to allow GNOME applications that run audio events though libCanberra to allow users to select visual events to replace them. This is an accessibility-minded effort to help both visually and aurally impaired users gain the benefits of audio alerts and such.
For our first demo we're simply trying to make the entire screen flash with a color when a button is pressed in our simple GTK sample app. I've been looking at the GTK documentation and all drawing that I've seen has had to do with drawing directly to a window or other widget. I want to control the entire screen's hue. Would this be a GDK thing? Am I completely off base?
Any links/help will be much appreciated! Thanks.
PS: This is being written in C, though functions should be the same between languages with proper bindings, I assume.

You cannot. Your application has access only to its own window, and does not (and should not) know anything about other windows, or the screen. The "screen" is managed by whatever back-end GTK uses (X? Win32? DirectFB?).
That said, you could try to create a "full-screen" window that covers the entire screen area. That is the way full-screen apps are implemented in most windowing systems.

GTK doesn't have such option AFAIK, you probably want to use the backend: Xlib (or Xcb) for that.

Related

WPF and DirectX - Game Overlay

Greetings
I've read WPF utilizes DirectX so I'm wondering if it is possible to create a Game Overlay with WPF. I have tried with Winforms or WPF by itself and the transparent forms or windows always cause problems for streaming software thus I'm wondering is it possible to do the following:
Create a WPF application which shows a Window on the desktop with all the options needed for the overlay. Once all the options is filled in you can press Update and the Overlay is created in the game with all the information on it. The WPF app itself won't be visible on the stream. This means all the viewers will not have any trouble with it when the broadcaster changes settings.
More about the overlay
The overlay will be a scoreboard so it will need a set amount of info. For example:
So to sum up my question(s)
Can I make a WPF application which
dynamically creates a DirectX overlay
ingame?
Since it needs to work in DirectX9,
is this project possible to make by a
single dev (me) which has little to
no exp with DirectX?
If it is possible, where should I
start?
Thanks in advance for all your possible insights and replies!
What you want would be possible using D3DImage. It allows you to host any Direct3D content within WPF and also allows you to have overlay with transparency. Here is a simple example.
From your comment above, it sounds like your really trying to inject your overlay (at least from the user's perspective) into Starcraft II. You would almost have to host a copy of the directx buffer.
Also, besides WPF, you might want to look at XNA.

User input custom control (text editor)

I am developing a CAD like application. This application is cross platform in the sense that I have a main window which is native to the platform it is running on (Linux, Windows and Apple). Within this window I have an OpenGL context and there I do all my rendering. The application in question does not really rely on common controls (radio buttons, check-boxes, labels etc), however there is the need for the user to be able to enter/edit some text. This text could be a few lines long but not more than one hundred.
How would I go about implementing such a control, I don't want to go as deep as developing my own text editor but it would be nice if it had some basic editor controls (cursor movement, delete, insert etc). I also don't want to use the native systems common controls as my own none cross platform code at the moment is the main window.
Any ideas?
Edit: This is informative
OPENGL User Interface Programming
Thank you
I think you are taking a longer approach here.
Rather than providing an interface through OpenGL and writing my own controls, I would go for a cross-platform GUI toolkit such as wxWindows, and use the GLCanvas provided to do my rendering. You'll have all the might and flexibility of common controls, you'll still be able to OpenGLize whatever you want, and the look of your application will be more standard, thus friendlier.

Resource files or 'CreateWindow' function for GUIs?

My program has a static interface, but I don't know what's the best way to make my interface. With resource files or with the CreateWindow function using the WM_CREATE message?
Thanks
Id recommend starting with dialog resources first. Then, if/when that is insufficient, make your own windows directly.
As a hardcore native developer, if you really want to make applications with a nice GUI, i hate to say this, but you'll get much more bang for your buck if you go with .NET's WPF - or even Windows Forms as a window layout language.
MS have made a concerted (and to my mind, somewhat malicious) effort to not add necessary new features for native applications so we are left building everything from scratch: the native controls don't support alpha aware painting, don't support back buffering, havn't been upgraded with the new Windows 7 widgets like ribbon bars, havn't been given any kind of animation system, and the dialog template based layout system is inflexible at best.

X11: How to make the application to be on top

Situation I'm using matchbox keyboard which is X11 based application. When any application is in full screen mode matchbox keyboard cannot be visible as the full screened application is on TOP. So is there a way to launch X11 based application over full screened applictions ?
You can look at the source of those GTK functions and see how they are implemented for the X11 backend:
gtk_window_set_keep_above()
gtk_window_set_keep_below()
gtk_window_set_transient_for()
I think it is the best way to know how you can do that, surely the solution GTK adopted should be portable.

How to control MFC application from another program?

I have a binary application on windows (train timetable software) which contains a lot of interresting data which I need for my project (nothing illegal, just some weird optimization algorithm). But the application has no api and the data files have undocumented binary form.
So my idea is to control the application from my own code. I would like to send keystrokes to it to fill a form, run query and save result to a file (there are buttons and menu items for this in the app). And repeat many times.
Is there a library for this? Or an example? I have a general idea how to do it, but I am lazy and I do not want to invent the wheel.
Also, the same data is available on the web. Is there some solution for the same task with ASP (Win forms) web applications? I could probably handle parsing the results but I do not know how to fill the values of webforms controls.
Thanks in advance.
You can use simple Win32 APIs to do this.
FindWindowEx and then once you have the window handle you can send any message (such as WM_KEYDOWN) to it by using SendMessage.
A good tool which helps with this process is Spy++ because it allows you to see the window hierarchy more easily and also which messages are being used internally for the application you are monitoring.
As for web form controls, you will probably have to do more work than this because typically the web will be one canvas control that things are drawn custom onto depending on the browser. Perhaps doing this via some kind of proxy is a better approach where you actually filter the HTML pages.

Resources