Solaris dtwmrc help


 
Thread Tools Search this Thread
Operating Systems Solaris Solaris dtwmrc help
# 8  
Old 06-13-2014
Thanks for the response MadeInGermany. I followed your instructions and downloaded and compiled the C code for xraise. However, I can't get it to work. I ran the "xwininfo" program and got my window's info (it returned 0xc00005 "My Program"). I ran xraise: ./xraise "My Program" but it did nothing. No errors, just sat there (I had to CTRL-C it).

When I compiled the code, I noticed several warnings such as "return makes integer from pointer without a cast". Do you get these cast warnings when you compile the program?
# 9  
Old 06-13-2014
Yes, I got the compile warnings, too.
Still it works for me, tested on a SparcStation, $DISPLAY was :0.0.
If it doesn't find the window:
Code:
$ ./xraise "xy not exist"
Cannot find a window by that name.
$

# 10  
Old 06-13-2014
Changing the display variable had no effect. The program still won't do anything. It just hangs. These systems are pretty old, so that may have something to do with it.

I wrote my own C code to raise an X Window with the XRaiseWindow function (Xlib Programming Manual: XRaiseWindow). It works, but only if I hard-code the window's hex value (like 0xc00005) into the program before compiling. If I try to get the window's hex value from argv[] as a parameter, I get a BadWindow error.

Any idea on how to get the window's hex value as a parameter? Code:

Code:
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>

int main(int argc, char **argv) {
  Display *display = XOpenDisplay(NULL);
  Window window = argv[1];

  XRaiseWindow(display, window);
  XSetInputFocus(display, window, RevertToNone, CurrentTime);
  XCloseDisplay(display);
}

This will only work if I replace argv[1] with the actual hex value of the window gotten from the "xlswins" command.
# 11  
Old 06-13-2014
Maybe you must convert the string argv[1] to an int?
Try
Code:
char *ep;
Window window = strtoul(argv[1], &ep, 16);

# 12  
Old 06-13-2014
Quote:
Originally Posted by bitnix
This will only work if I replace argv[1] with the actual hex value of the window gotten from the "xlswins" command.
So just do that, run xlswins to retrieve the window id (if any) and use xraise the way it works for you.
# 13  
Old 06-13-2014
Quote:
Originally Posted by MadeInGermany
Maybe you must convert the string argv[1] to an int?
Try
Code:
char *ep;
Window window = strtoul(argv[1], &ep, 16);

Well, that worked perfectly. I was trying to cast the parameter like (int), which was apparently wrong.

Thanks for the help. Now I can parse out the window hex value with a simple shell script and raise it with this C code. Exactly what I wanted!
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Solaris

How to add Solaris text console to Solaris grub2 menu?

Hi, I am new to sloaris and just instlled the solaris 11.2, i know little more about linux, i open the /boot/grub/grub.cfg in solaris and there is many other entries forl solaris 11.2 one of them is for 'Oracle Solaris 11.2 text console' but at boot grub2 only show the first default entry that... (1 Reply)
Discussion started by: shamsat
1 Replies

2. Solaris

Workspace Manager Menus - dtwmrc file

When I execute this command: exec xterm –e $SHELL –c “sed –n 4p /folder1/folder2/folder3/file.dat; $SHELL” I have the expecting result: It opens an new terminal, it shows the 4th line of the file and the terminal window stays open  perfect. So I tried to write it in the dtwmrc file to have an... (1 Reply)
Discussion started by: damientdm
1 Replies

3. Solaris

Unable to login using ssh,telnet onto my solaris machine with solaris 10 installed

Hi, I am unable to login into my terminal hosting Solaris 10 and get the below error message "Server refused to allocate pty ld.so.1: sh: fatal: libc.so.1: open failed: No such file or directory " Is there anyways i can get into my machine and what kind of changes are required to be... (7 Replies)
Discussion started by: sankasu
7 Replies

4. Solaris

application compiled on solaris 10 throwing error when executed on solaris 9

I have compiled my application on Solaris 10 with following description SunOS ldg1 5.10 Generic_138888-03 sun4v sparc SUNW,Sun-Blade-T6320 The compiler is Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25 But when installing the application on Solaris 9 SunOS odcarch02 5.9... (2 Replies)
Discussion started by: ash_bit2k2
2 Replies
Login or Register to Ask a Question