[gephex-devel] gephex--main--0.4--patch-1872

gephex at sonnenland.kexbox.org gephex at sonnenland.kexbox.org
Sat Apr 2 01:48:27 CEST 2005


Archive: gephex at gephex.org--2004
New revision: gephex--main--0.4--patch-1872

--
Revision: gephex--main--0.4--patch-1872
Archive: gephex at gephex.org--2004
Creator: The Gephex Source Archive <gephex at gephex.org>
Date: Sat Apr  2 01:45:35 CEST 2005
Standard-date: 2005-04-01 23:45:35 GMT
Modified-files: modules/src/frboutmodule/x11output.c
New-patches: gephex at gephex.org--2004/gephex--main--0.4--patch-1872
    martin at gephex.org--2004/gephex--martin--0.4--patch-67
Summary: [MERGE-REQUEST] remove broken part of 1871 patch
Keywords: 

Patches applied:

 * martin at gephex.org--2004/gephex--martin--0.4--patch-67
   remove x11 shared mem resize patch

* added files

    {arch}/gephex/gephex--main/gephex--main--0.4/gephex at gephex.org--2004/patch-log/patch-1872
    {arch}/gephex/gephex--martin/gephex--martin--0.4/martin at gephex.org--2004/patch-log/patch-67

* modified files

--- orig/modules/src/frboutmodule/x11output.c
+++ mod/modules/src/frboutmodule/x11output.c
@@ -65,7 +65,7 @@
                                      char* error_text, int text_len);
 */
 static int init_xshm_stuff(struct DriverInstance* sh, char* error_text,
-                           int text_len, unsigned int size);
+                           int text_len);
 
 static void deinit_xshm_stuff(struct DriverInstance* sh);
 
@@ -103,7 +103,6 @@
   XShmSegmentInfo shminfo;
   int completion_type;
   int event_pending;
-  unsigned int shm_size;
 
   // used if Xv extension is available
   XvPortID xv_port;
@@ -188,7 +187,6 @@
   sh->xv_port         =  0xffffffff;
   sh->xv_format_id    = -1;
   sh->xv_image        =  0;
-  sh->shm_size        =  0;
   
   if (strcmp(server_name,"default") == 0)
     server_name_ptr = getenv("DISPLAY"); //use the DISPLAY environment variable
@@ -272,15 +270,6 @@
 
   if ((sh->used_extensions & USE_XSHM) == USE_XSHM)
     {
-      if (init_xshm_stuff(sh, error_text, text_len,
-			  640 * 480 * 4) == 0)
-        {
-          deinit_xv_stuff(sh);
-          XDestroyWindow(sh->display, sh->win);
-          free(sh);
-          return 0;
-        }
-
       if ((sh->used_extensions & USE_XV) == 0)
         {
           /* create shared memory ximage */
@@ -457,14 +446,6 @@
       convert_to_16_inplace(sh->ximage->data, sh->width, sh->height);
 
   // blit shared mem image
-      
-  // todo handle the error message
-  if ( sh->shm_size !=  sh->width * sh->height * 4 )
-    {
-      deinit_xshm_stuff(sh);
-      init_xshm_stuff( sh, 0, 0, sh->width * sh->height * 4 );
-    }
-  
   XShmPutImage(sh->display, sh->win, sh->gc, sh->ximage,
                0, 0, 0, 0, sh->width, sh->height, True);
   sh->event_pending = 1;
@@ -503,14 +484,8 @@
       height != sh->image_height)
     {
       if (sh->xv_image)
-	{
-	  XFree(sh->xv_image);
-	  deinit_xshm_stuff(sh);
-	}
+        XFree(sh->xv_image);
 
-      
-      // todo handle the error message
-      init_xshm_stuff(sh,0 ,0 ,width*height*4);
       sh->xv_image = XvShmCreateImage(sh->display,
                                       sh->xv_port,
                                       sh->xv_format_id,
@@ -950,26 +925,28 @@
 /***************************************************************************/
 
 static int init_xshm_stuff(struct DriverInstance* sh, char* error_text,
-                           int text_len, unsigned int size)
+                           int text_len)
 {
   sh->completion_type = XShmGetEventBase(sh->display) + ShmCompletion;
   sh->event_pending = 0;
 
   /* allocate shared memory */
+
+  // changed flags from 0777 to 0666, see
+  // http://lists.apple.com/archives/unix-porting/2004/Apr/msg00081.html
   sh->shminfo.shmid = shmget (IPC_PRIVATE,
-                              size,
-                              IPC_CREAT|0777);
+                              MAX_RES_X * MAX_RES_Y * 4,
+                              0666 | IPC_CREAT);
 
   if (sh->shminfo.shmid == -1)
     {
-      snprintf(error_text, text_len, "shmget() failed!");
+      snprintf(error_text, text_len, "shmget() failed, errno=%i!", errno);
       return 0;
     }
 
   /* attach shared memory to our process */
   sh->shminfo.shmaddr = shmat (sh->shminfo.shmid, 0, 0);
-
-  if (sh->shminfo.shmaddr == -1)
+  if (sh->shminfo.shmaddr == (void*) -1) // TODO
     {
       shmctl (sh->shminfo.shmid, IPC_RMID, 0);
       snprintf(error_text, text_len, "shmat() failed!");
@@ -990,8 +967,6 @@
       return 0;
     }
 
-  sh->shm_size=size; // remember the size og the shm segment
-    
   return 1;
 }
 
@@ -1006,8 +981,6 @@
 
       sh->shminfo.shmaddr = 0;
     }
-  
-  sh->shm_size=0; // remember the size og the shm segment
 }
 
 static int init_xv_stuff(struct DriverInstance* sh, char* error_text,



More information about the gephex-devel mailing list