discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOpenGLView : exposing problem.


From: Omniscient
Subject: Re: NSOpenGLView : exposing problem.
Date: Thu, 2 Apr 2009 01:24:05 -0700 (PDT)
User-agent: G2/1.0

On Apr 2, 12:42 pm, Omniscient <obj...@gmail.com> wrote:
> When I cover part of glview with something it will turn black.
> Is there a way to tell a glview to redraw itself whenever xexpose
> event happen?
> Or is there a way to cache the drawable some how?
> What's better between caching drawable of a glview and then show it on
> expose
> or just let the glcontext convert xexpose event to glview
> setNeedsDisplayInRect: ?
>
> Thakns


welll this is my current work-around, pretty hackish. just for a
further description of the problem.
(this didn't solve the context exception problem)

Index: Source/x11/XGGLContext.m
===================================================================
--- Source/x11/XGGLContext.m    (revision 28164)
+++ Source/x11/XGGLContext.m    (working copy)
@@ -129,6 +129,9 @@
                             xVisualInfo->depth, InputOutput,
xVisualInfo->visual,
                             mask, &window_attributes);

+  Atom atom_glview = XInternAtom(win_info->display,
"_GNUSTEP_OPENGLVIEW_POINTER", False);
+  XChangeProperty(win_info->display, xwindowid, atom_glview,
XA_CARDINAL, 32, PropModeReplace, &view, 1);
+
   XMapWindow(win_info->display, xwindowid);

   attached = view;
Index: Source/x11/XGServerEvent.m
===================================================================
--- Source/x11/XGServerEvent.m  (revision 28164)
+++ Source/x11/XGServerEvent.m  (working copy)
@@ -988,6 +988,26 @@
             {
               generic.cachedWindow
                 = [XGServer _windowForXWindow:xEvent.xexpose.window];
+                         {
+                                 gswindow_device_t *device = [XGServer
_windowForXWindow:xEvent.xexpose.window];
+                                 if (device == NULL)
+                                 {
+                                         Atom actual_type;
+                                         int actual_format, num_items, 
bytes_left;
+                                         int *pointer_value = NULL;
+                                         NSView *aView;
+
+                                         Atom atom_glview = XInternAtom(dpy,
"_GNUSTEP_OPENGLVIEW_POINTER", True);
+                                         if (atom_glview && 
XGetWindowProperty(dpy,
xEvent.xexpose.window, atom_glview, 0, 1, False, XA_CARDINAL,
+                                                                       
&actual_type, &actual_format, &num_items, &bytes_left,
+                                                                               
(unsigned char **) &pointer_value) == Success)
+                                         {
+                                                 aView = *pointer_value;
+                                                 XFree(pointer_value);
+                                                 [aView setNeedsDisplay:YES];
+                                         }
+                                 }
+                         }
             }
           // sub-window ?
          /*


reply via email to

[Prev in Thread] Current Thread [Next in Thread]