Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Write an article for LinuxForums Today! Win Great Prizes!
I'm no great programmer, but I like to think of myself as a hacker and tinkerer, and am pretty good at picking up on technical stuff if I find the right introduction.
Anyway, I'm sick of the lack of WMs that suit my needs, so I'm coding my own based off of TinyWM.
I'm not making something incredibly fancy. If you have used BadWM, then you will know exactly what I want - NO window decorations except for some indication of which window has focus, keyboard shortcuts for a few basic tasks, and virtual desktops. The only reason I'm not just relying on BadWM is because it is unstable.
Anyway, here is my problem.. I have yet to find the answers to my problems! I've been reading the TinyWM source for the past week or two, and haven't quite figured out how it is determining what key is being pressed (I know how it is capturing the keys, but how is it deciding that F1 is F1? I have included the TinyWM source at the bottom of the post).
My first step is implementing a shortcut to launch RXVT.
Also, if anybody could help me in understanding the process in executing a program from the WM, I'd appreciate it. The X11 Programming Manual I have doesn't exactly provide enough clarification for my tastes (eh, it's summer, I'm home from college, and I'm lazy :P)
Oh yeah.. This is my first foray into Linux C programming I have experience in C++, x86 ASM (self taught), PHP, VB.Net (hate it), HTML, Javascript, Turbo Pascal, and BASH. Most of my experience is in Windows programming.
I know how it is capturing the keys, but how is it deciding that F1 is F1?
I'm not sure I understand the question.I'm not very familiar with
X windows but as far as I can see it grabs F1 so if it sees KeyPress it knows
it's F1.That's what I assume is happening anyway.I could be completely off.
I'm actually talking about the part in the for loop.. The series of nested if-then-else statements. It is apparent to me that the first if-then is the statement that raises the window to the front. How does it know that when F1 is grabbed that THIS is the statement it is supposed to execute? I see no conditional that checks for F1 for it. I compiled it and ran it to test, and sure enough, it somehow knows that F1 brings the window to the foreground..
As I said I'm only speculating but it says if(ev.type == KeyPress
Since it has arranged earlier to grab the press of F1 (and presumably nothing else) ,
if the last event was KeyPress it knows it was F1.
However, I get Segfaults. I get a warning that dpy (see source in first post) may be unitialized or not used (or something like that) when compiling, and when I run it, once I move the mouse it segfaults.
cc -Os -pedantic -Wall -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -o hactwm hactwm.c
hactwm.c: In function `main':
hactwm.c:12: warning: `dpy' might be used uninitialized in this function
Segmentation fault error is nothing special. 2572 is the code it gave, IIRC. I can't copy/paste it because I don't use GPM (or whatever it is), and can't pipe the startx output .
Open Source Security Myths Dispelled Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization subscribe
InformationWeek InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology. subscribe