Drawing a Rectangle that never dissapears - linux

I have to draw a transparent square, that never disappears from the user's interface, by clicking to other windows the rectangle remains, only the windows/application content has to be shown behind.
I have thought of doing it with OpenGl or Flex or Canvas , but the problem is whenever I click on another window the programmed rectangle disappears .The rectangle has to act as a default image but has to be always at the foreground.
Do I have to mess with the operating system(Linux, Mac or Windows), by creating this image as default?
here is one example
http://i42.tinypic.com/15g3vxh.png

You can do that with Java pretty easy. See this link for code examples. If you got your transparent Image, you can use the setAlwaysOnTop(true); Method on the Object, and you are good to go. The only things that could get in front of that are other Applications that are using that method.

Related

Missing pixels from upper left of window placed at origin

I have an application that uses a non-decorated window (no title bar and so on, it's eventually intended to be a full-screen application). It also has one-pixel-wide line images around the outside to form a natural border with the outside world.
When I run this application and the Window gets its default position (i.e., not at the (0,0) origin), the borders are clearly visible.
However, when I perform a this.Move(0, 0) in the constructor of the main window to make sure the window is positioned correctly, the upper-right pixels seem to disappear thus:
Ignore the Act text in that capture, it's actually the Activities menu under Gnome desktop. The actual upper-left pixel of the window is where those two red lines would meet.
Does anyone know what could be causing this issue? Is it possibly something to do with the Gnome Shell extensions taking control of that area?
The missing pixels are an artifact of the way gnome-shell does rounded rectangles for its windows.
If you really want to change it, you can edit the file /usr/share/gnome-shell/theme/gnome-shell.css. Look for the CSS selector .panel-corner and set -panel-corner-radius to 0px. This will cause the windows to have square corners rather than rounded ones. You will probably need to restart gnome-shell after making the change by pressing Alt-F2 and enter the r command.
Whether that edit will survive a gnome-shell (or even a theme) update is unsure, you may have to put into place something that keeps it at the value you want (or install an extension to do that for you).
That is how gnome-shell renders the top corners of the main monitor, it's a rounded corner, just not very visible with black on black. Changing this rendering is not something an application should do.
If your application is supposed to be full screen instead of just positioned at the corner, you could request gnome-shell to do that with Window.fullscreen(). Do not rely on always being full screen though: the window manager can decide otherwise.

Propagating all events from a X window

I'a currently working on a small utility, it's my first ever X project. The utility is used to draw a small circle around your mouse pointer. I use an app called Pinpoint to do the same on my Mac, it helps me find my mouse as I'm visually impaired.
The utility creates an transparent X window and draw a circle inside, it then moves that window with the mouse pointer so that the circle follows the mouse.
It currently works, except for one detail. Mouse events are not propagated up to the underlying windows. Basically, the utility makes the mouse useless.
As far as I can tell from the Xlib docs, if not otherwise specified, new windows should propagate all events. How can I fix this?
The code can be found on GitHub: https://github.com/blubber/circle-cursor it's a bit messy currently, becaue it is just a proof of concept.
I would suggest doing via cursor image as well, there are many ways when you won't be able to receive mouse events and only possible source would be polling with XQueryPointer.
With xfixes extension you can subscribe to all cursor image changed events and get most recent shape of the cursor, and whit XRender you can set your own ( possibly animated cursor )

MergEXT MergZXing layer and barcode not reading

Just started working with this awesome external but have a couple of questions.
When the control is evoked, is it always the top layer or can I have a background transparent image on top of it so I can frame the control nicely?
Also, my testing seems to read most Barcodes but when it comes down to reading Barcodes on hard drives, the control does not want to decode those.... Too dense of bar code pattern?
I am very impressed thus far with the ease of use of your externals. Makes we want to code more for mobile devices!
an overlaying transparent image is not possible, as far as i know.
but couldnĀ“t you use
command mergZXingControlSetRect pLeft,pTop,pRight,pBottom
to define the rect of that scanner after creation
or
command mergZXingControlCreate pLeft,pTop,pRight,pBottom
to create the scanner control in the specified rect.
Set the rect smaller than the width and the height of the screen.
You could then use an underlying image, which is displayed outside of the scanner rect, to show the frame around scanner control. Did not test it myself, but i would assume that this should work.
Unfortunately the native controls in externals and the ones the engine provides are added as views on top of the LiveCode view. That means you can't intermingle LiveCode controls with them. One thing that some users have done is add a web view with a transparent background and a load a png image. If you create the barcode view first and the web view second then the web view will be on top.

UIImageView doesn't obey it's content mode

I am designing an iOS App where there is a View controller with an embedded view controller in view at the bottom, and an image at the top. However, I'm having problems with the Image view. Without image view, everything is OK. When I put the image view, the image view doesn't fit in the image correctly. Here is how it looks in the interface builder (set to Scale to Fill):
When I run it in my iPod Touch (iOS 6), This is how it looks:
The image's aspect ratio is different than shown in the Interface Builder. Then, I try setting the image mode to Aspect Fill (which is actually the one I want):
This is exactly what I actually want, but when I run it, the image fills almost the entire screen:
Notice how my friend picker view controller is left behind the image view. The layout of the entire view controller is correct (embedded view controller is located correctly, notice at the point where the image ends in the last screenshot, it starts from J, meaning that it continues to the top behind the image), it's only the image view that is occupying too much space. I've tried different arrangements of the frame rectangle, and tried toggling Auto-layout of iOS 6. Neither did help. Am I missing an obvious point, or is it a bug with the layout system of iOS. (probably the second one, as WYSIWYG fails between Interface Builder and actual app) Are there any workarounds (other than cropping the portion of the image in Photoshop at the exact size that I want)?
Thanks,
Can.
UPDATE: A workaround that I've currently found is to put the image view in another view, and set the parent view's clip subviews property ticked. But the image view itself is still not behaving correctly, and even though this currently solved my problem, it is not a real solution, so any solution answers are welcome.

Menu Bar Height in the LWUIT Form

Application develop in the J2ME using LWUIT. When I port this application on the Samsung Device it create the following problem.
int h = Display.getInstance().getDisplayWidth();
It returns 388 for the Samsung GT S5250. So when I draw an image using this dimension it displays a white strip at the bottom of the screen. When I call the Form.show() it displays correctly and height is 400 so how to resolve this issue.
I want to know how the Form size is calculated in LWUIT and how it takes MenuBar Height and white strip display at bottom of the screen.
I think you typed getDisplayWidth() where you meant to type getDisplayHeight().
Regardless, the problem you are seeing is due to a bug in the samsung device. LWUIT invokes the full screen mode in MIDP which hides the native title area, however that doesn't always happen immediately in some devices and thus LWUIT gets incorrect information from the devices. A refresh usually solves this and by the time LWUIT draws on the screen the size is corrected.
Generally the solution is rather simple, create generic code to create your image and if the image dimensions are inappropriate when you are about to draw to the screen then just recreate the image on the fly. This will also solve the issue of device rotation which might pose a problem too.

Resources