You are not logged in.
Pages: 1
i may also be interested in developing my own widget type interface. could someone explain to me how to display an image through the x window system. and allow mouse coordinates to image coordinates???
spiritech
Offline
Are you trying to write something like gtk from scratch?
Offline
Moving to Programming and Scripting.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Are you trying to write something like gtk from scratch?
maybe. i am not sure that it would be to difficult. if i could match mouse co-ordinates to image co-ordinates in an x window display then the bulk if the work is done, from then it would be a case of.
if [ mouse co-ordinate xy matches image xy ]; then command1 command2 etc; fi.
i would also like to try and keep it purely bash.
i would also need to figure out how to embed terminal text etc into the image, infact this would be my biggest obstacle. the image side of things would be simplier as i could use blocks like in gtk to overlay onto the base image. i can write scripts that ask for user input in a terminal. so how can i embed the terminal into the image.
from what i understand the two main factors i need to acheive are the image side of things and user input, from there its all upwards.
well maybe not as simple as i thought.
Offline
so my back to my original question. does anyone know how i can display an image in an x window and then match mouse cordinates to image coordinates?
Offline
so my back to my original question. does anyone know how i can display an image in an x window and then match mouse cordinates to image coordinates?
I really think you need to walk before you try to run.
To be honest, it strikes me that your level of expertise is that where you do not know what you do not know. As you learn a bit more (considering also your GTK thread), you will learn what it is you do not know and will figure out what it is you need to study. It is almost as if you are asking, what is the answer to e^(pi * (-1)^(1/2)). If I tell you -1, you would not be able to do anything useful with that until you learn a little more about Euler.
I would work on creating some simple Gtk applications first (or Qt, or wxWidgets, or Tk/Tcl -- I picked Gtk because of your other thread). Then, search the Community Contributions subforum for window managers. There are a dozen of them in the first few pages. Download, read, and compile one of them. Modify it. Play with it.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
You will have to use a language that supports the Xlib api like C, C++, python, haskell etc. Bash won't work afaik.
see man XQueryPointer
You're just jealous because the voices only talk to me.
Offline
ok. so so far know one can tell me how to match mouse co-ordinate with image co-ordinates. the co-ordinates must exist somewhere in my system. so must be possible to call into a bash script.
Offline
You will have to use a language that supports the Xlib api like C, C++, python, haskell etc. Bash won't work afaik.
see man XQueryPointer
thankyou will take a look at man XQueryPointer.
apart from that i guess i'll give up for now. as its probably not as simple as just matching co-ordinates.
Last edited by spiritech (2014-02-03 22:26:57)
Offline
You will have to use a language that supports the Xlib api like C, C++, python, haskell etc. Bash won't work afaik.
see man XQueryPointer
from man XQueryPointer
ARGUMENTS
child_return
Returns the child window that the pointer is located in, if
any.
display Specifies the connection to the X server.
mask_return
Returns the current state of the modifier keys and pointer
buttons.
root_return
Returns the root window that the pointer is in.
root_x_return
root_y_return
Return the pointer coordinates relative to the root window's
origin.
w Specifies the window.
win_x_return
win_y_return
Return the pointer coordinates relative to the specified win‐
dow.
looks like might be what i need. now to learn how to load an image in an x window>>
Last edited by spiritech (2014-02-03 22:41:29)
Offline
Pages: 1