Automatically tile/arrange windows created with OpenCV (HighGUI) - c

I'm creating windows for debugging like this:
cvNamedWindow("a",0); cvShowImage("a", imageA);
cvNamedWindow("b",0); cvShowImage("b", imageB);
cvNamedWindow("c",0); cvShowImage("c", imageC);
OpenCV creates all these windows in the exact same spot, which is not very practical, since only one of them is visible unless you move them around.
Can I make OpenCV automatically arrange the windows so that all of them can be seen (like a tiling window manager)? Or do I have to do this myself using cvMoveWindow?

No, this is impossible - there's no such feature in User Interface (I also was wondering about such functionality a month ago).
You have to manualy set window(s) position by calling MoveWindow - this is the only solution.

Related

CEF disable address bar

I am using CEF3 and want to hardcode and disable the address bar of the browser. I am not finding the right place in the code base to do the same. Any pointers would be of great help.
Either through the C++ or Javascript methods would help.
Thanks,
Ashwin
Are you using cefclient? I don't think there's a clean way to turn it off in the standard version of cefclient.
However, in the brackets-shell fork of cefclient there's a #define you can use to toggle it on/off cleanly. Just search for references to SHOW_TOOLBAR_UI (it's only used in four files). I'm guessing it wouldn't be too hard to manually apply those diffs back onto a clean copy of cefclient (you probably don't want to take the brackets-shell fork as-is – it's not very generic).
You can build a CEF application using the binary, just like the WIKI does. Please see the github project for a reference https://github.com/acristoffers/CEF3SimpleSample
I realize this question is old but I had the same question and found the solution.
In the cefclient example, the address bar is drawn within the RootWindowGtk::CreateRootWindow function.
Delete the gtk_container_add function call that adds the GtkToolItem* corresponding to the address bar and the address bar will be gone.

Multisampling (MSAA) for DirectX11/DirectX10 with D3DImage shared resource

I am trying to get MSAA in DX11 using D3DImage, but is seems, it is not possible, since shared multisampling texture are not allowed, as stated here: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476531(v=vs.85).aspx
Actually, I use the SharpDX implementation of the D3DImage, which works fine for DX11 and DX10 as long one can leave without anti alisasing.
Approaches to solve it are described in this thread: http://sharpdx.org/forum/5-api-usage/1000-d3d11-problem-with-usage-of-texture2d which are not successful. There is yet another thread asking a similar question: Multisampling and Direct3D10 / D3DImage interop
Finally, the question is in fact, if anyone can confirm, that it is definitly NOT possible to use D3DImage for rendering of anti-aliased content from DX10/DX11?
As said in the microsoft link (tried several times as well), multisampled shared textures are not allowed (actually texture must also have no mip level(s), as additional info)
The only way to share the texture is to create a non multisampled version (same format/parameters), then use
DeviceContext.ResolveSubresource
in SharpDX to convert the msaa texture into a non multisampled one, then you can share the result of that.

Problems detecting key combinations in WinForms app under Mono on Mac

I'm trying to get a .net 2 Windows.Forms application running on the Mac using Mono. The application has key combination short cuts for all functions, which have pre-defined defaults and can be reconfigured by the user. The Form KeyDown event handler looks up the action to be performed.
My problem is relating the Modifiers and KeyCode to the actual keys pressed. I don't mind if some mapping needs to be added for the Mac, but I need at least 3 modifier keys. However of the 4 modifiers on the Mac, few seem to produce obvious results. I get:
Shift - works as expected
Ctrl - reports a different KeyCode, but with correct modifier (eg Ctrl+N has Modifiers = Control and KeyCode 14 = "RButton, Clear").
Alt - reports some other key, unmodified (eg Alt+R gives KeyCode = 168 = "BrowserRefresh")
Cmd - reports as Alt with expected KeyCode (eg Cmd+N appears as Alt-N)
I presume that the Cmd key would normally be used where Ctrl is used on Windows. Can anyone advise which of the three Mac keys I should be trying to use? And most importantly how to parse the KeyEventArgs to consistently report a base key plus three optional modifiers?
Mono is the latest version (as of a week or two ago), and it's a MacBook Air, OS X 10.8.1 if that makes any difference.
I get the same issues. Try using IRC and asking at irc.gnome.org on rooms Mono and MonoMac. Very helpful folks.
Apparently with MonoMac, which lets you build a native UI in Interface Builder and helps stub out your backend C# code to talk to it (that is, MonoMac is Mono talking to native Mac, not Mono running on a Mac; the second is just plain Mono), Windows.Forms support has dropped to the wayside -- I was told that Windows.Forms is essentially "dead" on the Mac, and the quiet bugzilla page seems to support that. It really is quite buggy. I ran into SelectionBackColor not working in RichTextBox right off the bat, then menu accelerators not working reliably. Windows.Forms on Mac is alpha to beta quality, I think.
That said, for what's essentially a labor of love, a surprising amount of Windows.Forms works well, but I wouldn't use it for a polished app. Good luck.
EDIT: I realize the OP wasn't specifically talking about menuitems, but here's a bug report about accelerators and menu items not working so well, just to speak to related bugginess.
[Mono-bugs] [Bug 75996][Maj] New - menuitem event not triggered by Shortcut
Windows.Forms on Mono is so close to working, it's tempting to think it's going to support what you need to get done, but, imo, to consider it solid enough for use beyond making quick utilities would be a mistake.
In case it's useful to anyone, this is where I ended up:
I eventually managed to hack my way around this particular 'feature' by creating a new KeyData value to replace the one provided by the event (this code running only if it's a Mac).
I swapped round some of the modifiers to make it more consistent with windows (ie if Cmd was pressed, and reported as Alt by Mono I changed that to Ctrl). I also filtered out ctrl+A to ctrl+Z which return KeyCodes 0 to 25 (not 65 to 90) and replaced these with their normal values.
Fortunately my code only wanted the KeyData. It wouldn't be possible to create a new KeyEventArgs using the updated data, since Mono checks the current keyboard state and sets modifier flags for any pressed modifier keys, in addition to any modifiers passed to the KeyEventArgs constructor.
BUT - as ruffin commented Mono on the Mac is very flaky. We've parked this work for the moment as it's taking quite a bit of time to work around all the problems. So far we've managed to find a solution for each item we've looked at, and may well come back to this - but at best it will be a nasty hack to get this S/W running on the Mac.

Identifying that a resolution is virtual on a X11 screen by it's API (or extensions)

I'm working in a embarked application on linux that can be used with different PC hardware (displays specifically)
This application should set the environment for the highest allowed resolution (get by
the function XRRSizes from libXrandr).
The problem is: With some hardware, trying to set for the highest option creates a virtual desktop i.e. a desktop where the real resolution is smaller and you have to scroll w/ the mouse in the edges of the screen to access all of it.
Is there a way to detect within the Xlib (or one of it's siblings) that I am working with a virtual resolution (In other words, the re-size didn't go as expected) ?
Hints for a work around for this situation would also be appreciated...
Thanks
Read this: http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt
You need to learn the difference between "screen", "output" and "crtc". You need to check the modes available for each of the outputs you want to use, and then properly set the modes you want on the CRTCs, associate the CRTCs with the outputs, and then make the screen size fit the values you set on each output.
Take a look at the xrandr source code for examples: http://cgit.freedesktop.org/xorg/app/xrandr/tree/xrandr.c

How to handle data from an external program on Mac OSx

I would like to make a program (I would prefer in C language) , but even in cocoa , that can take data from an external program (such as iTunes or adium) and will use them. For example i would like to take the data of a listbox or the text of the chat so as to manipulate it. I need a place to start. In windows I think it is possible with some apis that find the hWnd of a window and then find a pointer to the listbox or textbox. Please give me some info on how to start. Thanks you in advance.
It's not clear exactly what you want to do. It's either impossible or severely restricted.
For one thing, different applications use different ways of constructing a “listbox”—Cocoa applications use NSTableView, Carbon applications use DataBrowser, and GTK, Qt, and Java applications use even more different APIs. These do not all go through some common kind of list box thingy; each is an independent implementation.
(You could hope that either NSTableView or DataBrowser would be based on the other, but don't count on it.)
For another, it is impossible to obtain a pointer to that control. You cannot access another application's NSTableView or DataBrowser view or GTK/Qt/Java equivalent unless (and this only works for NSTableView) that application deliberately serves it up to you. It doesn't sound like that's your situation.
The closest you can get to that is Accessibility, which may be pretty close, but is unlikely to work with most applications not based on Cocoa.
Even then, the view may not be showing you all the data. A table view may be lazily populated, and a table view designed in imitation of the iOS UITableView may even never have all the data (because it only has what it can show).
(All of the above applies to every kind of view, not just table views. Collection views, text fields, buttons—same deal for all of them.)
The only way to get at the true, complete copy of the data is to ask the controller that owns it. And, again, that's impossible if the application is not specifically offering it to you. Not to mention, the application might not even have a controller (not object-oriented, not MVC, or just sloppily made).
… so as to manipulate it.
Getting the data in the first place is the easy part. It is nigh-impossible to mess with data in another application—for good reason.
The closest you're going to get to either of these goals is the Accessibility interfaces.

Resources