Sponsored Content
Full Discussion: Xlib registering
Top Forums Programming Xlib registering Post 302801887 by thedardanius on Thursday 2nd of May 2013 04:10:52 PM
Old 05-02-2013
Code:
int temp;
int attrib[]={GLX_RGBA,GLX_DOUBLEBUFFER,GLX_RED_SIZE,4,GLX_GREEN_SIZE,4,GLX_BLUE_SIZE,4,GLX_DEPTH_SIZE,16,None};
// Setting up GLX
hDis=XOpenDisplay(NULL);
if (hDis==NULL)
{
CMsgBox("Unable to open display. Program will now close","Error");
return false;
}
if (!glXQueryExtension(hDis,&temp,&temp))
{
CMsgBox("X server does not have GLX extension support. Program will now close.","Error");
return false;
}
hScr=DefaultScreen(hDis);
hVi=glXChooseVisual(hDis,hScr,attrib);
if (hVi==NULL)
{
CMsgBox("Unable to setup visual data. Program will now close","Error");
return false;
}
hCx=glXCreateContext(hDis,hVi,0,true);
if (hCx==NULL)
{
CMsgBox("Unable create OpenGL context. Program will now close","Error");
return false;
}
cMap=XCreateColormap(hDis,RootWindow(hDis,hVi->screen),hVi->visual,AllocNone);
// Setting properties
maxwidth=DisplayWidth(hDis,hScr);
maxheight=DisplayHeight(hDis,hScr);
wAtt.colormap=cMap;
wAtt.border_pixel=0;
wAtt.event_mask=KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|PointerMotionMask|FocusChangeMask;
wAtt.override_redirect=true;
if (width==-1)
{
width=maxwidth;
height=maxheight;
}
Pixmap icon;
XWMHints*wHints=XAllocWMHints();
XClassHint*cHints=XAllocClassHint();
XSizeHints*sHints=XAllocSizeHints();
XTextProperty wName,cName;
XStringListToTextProperty(&wndtitle,1,&wName);
XStringListToTextProperty(&wndtitle,1,&cName);
wHints->initial_state=NormalState;
wHints->input=false;
wHints->icon_pixmap=icon;
wHints->flags=InputHint|StateHint|IconPixmapHint;
cHints->res_name=wndtitle;
cHints->res_class="Wnd";
sHints->flags=PPosition|PSize;
//hIcon=XInternAtom(hDis,"_NET_WM_ICON",false);
//cardinal=XInternAtom(hDis,"CARDINAL",false);
// Init keys
CKEY_A=XKeysymToKeycode(hDis,XK_a);
CKEY_B=XKeysymToKeycode(hDis,XK_b);
CKEY_C=XKeysymToKeycode(hDis,XK_c);
CKEY_D=XKeysymToKeycode(hDis,XK_d);
CKEY_E=XKeysymToKeycode(hDis,XK_e);
CKEY_F=XKeysymToKeycode(hDis,XK_f);
CKEY_G=XKeysymToKeycode(hDis,XK_g);
CKEY_H=XKeysymToKeycode(hDis,XK_h);
CKEY_I=XKeysymToKeycode(hDis,XK_i);
CKEY_J=XKeysymToKeycode(hDis,XK_j);
CKEY_K=XKeysymToKeycode(hDis,XK_k);
CKEY_L=XKeysymToKeycode(hDis,XK_l);
CKEY_M=XKeysymToKeycode(hDis,XK_m);
CKEY_N=XKeysymToKeycode(hDis,XK_n);
CKEY_O=XKeysymToKeycode(hDis,XK_o);
CKEY_P=XKeysymToKeycode(hDis,XK_p);
CKEY_Q=XKeysymToKeycode(hDis,XK_q);
CKEY_R=XKeysymToKeycode(hDis,XK_r);
CKEY_S=XKeysymToKeycode(hDis,XK_s);
CKEY_T=XKeysymToKeycode(hDis,XK_t);
CKEY_U=XKeysymToKeycode(hDis,XK_u);
CKEY_V=XKeysymToKeycode(hDis,XK_v);
CKEY_W=XKeysymToKeycode(hDis,XK_w);
CKEY_X=XKeysymToKeycode(hDis,XK_x);
CKEY_Y=XKeysymToKeycode(hDis,XK_y);
CKEY_Z=XKeysymToKeycode(hDis,XK_z);
CKEY_0=XKeysymToKeycode(hDis,XK_0);
CKEY_1=XKeysymToKeycode(hDis,XK_1);
CKEY_2=XKeysymToKeycode(hDis,XK_2);
CKEY_3=XKeysymToKeycode(hDis,XK_3);
CKEY_4=XKeysymToKeycode(hDis,XK_4);
CKEY_5=XKeysymToKeycode(hDis,XK_5);
CKEY_6=XKeysymToKeycode(hDis,XK_6);
CKEY_7=XKeysymToKeycode(hDis,XK_7);
CKEY_8=XKeysymToKeycode(hDis,XK_8);
CKEY_9=XKeysymToKeycode(hDis,XK_9);
CKEY_SPACE=XKeysymToKeycode(hDis,XK_space);
CKEY_BACKSPACE=XKeysymToKeycode(hDis,XK_space);
CKEY_TAB=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_ENTER=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_RIGHT=XKeysymToKeycode(hDis,XK_Right);
CKEY_LEFT=XKeysymToKeycode(hDis,XK_Left);
CKEY_DOWN=XKeysymToKeycode(hDis,XK_Down);
CKEY_UP=XKeysymToKeycode(hDis,XK_Up);
CKEY_SEMICOLON=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_DIVIDE=XKeysymToKeycode(hDis,XK_slash);
CKEY_TILDE=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_RBRACKET=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_LBRACKET=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_SEPERATOR=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_QUOTE=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_MINUS=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_PLUS=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_PERIOD=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_COMMA=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_RSHIFT=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_LSHIFT=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_RCTRL=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_LCTRL=XKeysymToKeycode(hDis,XK_semicolon);
CKEY_ESC=XKeysymToKeycode(hDis,XK_Escape);
CKEY_F1=XKeysymToKeycode(hDis,XK_semicolon);
// Final window
hWin=XCreateWindow(hDis,RootWindow(hDis,hVi->screen),xpos,ypos,width,height,0,hVi->depth,InputOutput,hVi->visual,
CWBorderPixel|CWColormap|CWEventMask|CWOverrideRedirect,&wAtt);
icon=XCreateBitmapFromData(hDis,hWin,icon_bitmap_bits,icon_bitmap_width,icon_bitmap_height);
XSetWMProperties(hDis,hWin,&wName,&cName,NULL,0,sHints,wHints,cHints);
//XChangeProperty(hDis,hWin,hIcon,cardinal,32,PropModeReplace,(const unsigned char*)buffer,length);
glXMakeCurrent(hDis,hWin,hCx);
XMapRaised(hDis,hWin);
XSetInputFocus(hDis,hWin,RevertToNone,CurrentTime);
return true;


the code cant compile here, but it does at mine, no compiler errors. This is the code creating the window glx.
Sorry for the bad format, im still working on it...

Last edited by radoulov; 05-02-2013 at 05:26 PM..
 

7 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Problems registering

To the administrator I have created this global account "synamics" for our support team but have also tried creating a personal account "asayers" with the correct email address but the system has never emailed me my username and password when I request it and so cannot log in. My email address... (1 Reply)
Discussion started by: synamics
1 Replies

2. Programming

Problem in registering new netfilter target module

Friends I'm facing a big problem trying to extend the netfilter. Somone please help me with your quick reply (any hint) as I've to meet a deadline. My problem is that I've written a new netfilter target module and its corresponding userspace program for iptables to change the packet type of a... (0 Replies)
Discussion started by: Rakesh Ranjan
0 Replies

3. Shell Programming and Scripting

Registering Load time

I have a site with a few hundred pages. I want to know which pages load in more than 6 seconds. Is it possible? Is there any shell script or tool for this purpose? (0 Replies)
Discussion started by: shantanuo
0 Replies

4. Solaris

loginlog not registering failed logins

Hello guys, I made a loginlog file to register failed login attempts on my sun-blade 1500 server ( just studying at home) . The code below is how I created the file : # touch /var/adm/loginlog # chmod 600 /var/adm/loginlog # chgrp sys /var/adm/loginlog After creating the file, I... (1 Reply)
Discussion started by: cjashu
1 Replies

5. Forum Support Area for Unregistered Users & Account Problems

Trouble Registering? Countries or Regions Abusing Forums

The forums have been seeing a sharp increase in spam bots, forum robots, and malicious registrations from certain countries. If you have been directed to this thread due to a "No Permission Error" when trying to register please post in this thread and request permission to register, including... (1 Reply)
Discussion started by: Neo
1 Replies

6. Red Hat

Problem registering a new system

Hi, A registered a new system the other day using the subscription-manager (RedHat ES6, Academic edition) but it's not showing up on the web site so that I can entitle it and get updates, etc. Any ideas? ~ Rob (1 Reply)
Discussion started by: caspersgrin
1 Replies

7. Forum Support Area for Unregistered Users & Account Problems

Registering from blocked country

Hi, I'm come from Vietnam and want to join to Unix forum just because I like Unix programming and want to learning more. My IP is allocate by DHCP server so it is dynamic. Here is my desired username and my email: Username: lucasdo Email: rennersstar@gmail.com Thank you very much for... (0 Replies)
Discussion started by: lucasdo
0 Replies
All times are GMT -4. The time now is 06:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy