aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xwidget.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index d4882cebbf6..08964efa8b5 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -184,9 +184,12 @@ xwidget_setup_socket_composition(struct xwidget* xw)
184 //XCompositeRedirectWindow(); should probably replace the global backing request 184 //XCompositeRedirectWindow(); should probably replace the global backing request
185 //now residing in xwidget_has_composition() 185 //now residing in xwidget_has_composition()
186 186
187// int xid = gtk_socket_get_plug_window (GTK_SOCKET (xw->widget)); 187 int xid = gtk_socket_get_plug_window (GTK_SOCKET (xw->widget));
188// Display* dpy = GDK_DISPLAY (); 188 Display* dpy = GDK_DISPLAY ();
189 XCompositeRedirectSubwindows( dpy, xid,
190 CompositeRedirectAutomatic );
189 191
192
190/* 193/*
191 XWindowAttributes attr; 194 XWindowAttributes attr;
192 XGetWindowAttributes( dpy, xid, &attr ); 195 XGetWindowAttributes( dpy, xid, &attr );
@@ -280,8 +283,6 @@ xwidget_init (struct xwidget *xw, struct glyph_string *s, int x, int y)
280 gtk_socket_get_id (GTK_SOCKET (xw->widget))); 283 gtk_socket_get_id (GTK_SOCKET (xw->widget)));
281 send_xembed_ready_event (xw->id, 284 send_xembed_ready_event (xw->id,
282 gtk_socket_get_id (GTK_SOCKET (xw->widget))); 285 gtk_socket_get_id (GTK_SOCKET (xw->widget)));
283 if(xwidget_has_composition())
284 xwidget_setup_socket_composition(xw);
285 break; 286 break;
286 } 287 }
287} 288}
@@ -316,7 +317,8 @@ xwidget_draw_phantom (struct xwidget *xw,
316 //p_xid = XCompositeNameWindowPixmap( GDK_DISPLAY (), GDK_WINDOW_XID(xid)) ; 317 //p_xid = XCompositeNameWindowPixmap( GDK_DISPLAY (), GDK_WINDOW_XID(xid)) ;
317 318
318 printf("phantom socket 1: %d %d\n", xid, p_xid); 319 printf("phantom socket 1: %d %d\n", xid, p_xid);
319 xw_snapshot = gdk_pixmap_foreign_new(GDK_WINDOW_XID(xid)); //wraps the native window in a gdk windw, but it crashes! 320 xw_snapshot = gdk_pixmap_foreign_new(GDK_WINDOW_XID(xid));
321 //wraps the native window in a gdk windw, this doesnt seem to benefit from compositing
320 printf("2\n"); 322 printf("2\n");
321 }else { 323 }else {
322 //if its not a socket, its got a snapshot method that works 324 //if its not a socket, its got a snapshot method that works
@@ -343,6 +345,14 @@ xwidget_draw_phantom (struct xwidget *xw,
343} 345}
344 346
345 347
348/* gtk widget reparent snippet to be used:
349 g_object_ref((gpointer)xw->widgetwindow);
350 gtk_container_remove(GTK_CONTAINER(old_parent), xw->widgetwindow);
351 gtk_container_add(GTK_CONTAINER(new_parent), xw->widgetwindow);
352 g_object_unrefref((gpointer)xw->widgetwindow);
353*/
354
355
346 356
347void 357void
348x_draw_xwidget_glyph_string (struct glyph_string *s) 358x_draw_xwidget_glyph_string (struct glyph_string *s)
@@ -354,10 +364,11 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
354 364
355 BUG it seems this method for some reason is called with bad s->x and s->y sometimes. 365 BUG it seems this method for some reason is called with bad s->x and s->y sometimes.
356 When this happens the xwidget doesnt move on screen as it should. 366 When this happens the xwidget doesnt move on screen as it should.
357 This maybe might perhaps be because of x_scroll_run. Maybe emacs decide to scroll the screen by blitting sometime, 367 This mightbe because of x_scroll_run. Emacs decides to scroll the screen by blitting sometimes.
358 for reasons unknown. then maybe emacs doesnt try to actualy call the paint routines, which means this here code will never 368 then emacs doesnt try to actualy call the paint routines, which means this here code will never
359 run so the xwidget wont know it has been moved. hmm. 369 run so the xwidget wont know it has been moved.
360 370
371 Solved temporarily by never optimizing in try_window_reusing_current_matrix().
361 372
362 BUG the phantoming code doesnt work very well when the live xwidget is off screen. 373 BUG the phantoming code doesnt work very well when the live xwidget is off screen.
363 you will get weirdo display artefacts. Composition ought to solve this, since that means the live window is 374 you will get weirdo display artefacts. Composition ought to solve this, since that means the live window is
@@ -370,6 +381,10 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
370 int height = s->height; 381 int height = s->height;
371 382
372 int drawing_in_selected_window = (XWINDOW (FRAME_SELECTED_WINDOW (s->f))) == (s->w); 383 int drawing_in_selected_window = (XWINDOW (FRAME_SELECTED_WINDOW (s->f))) == (s->w);
384 //TODO drawing_in_selected_window can be true for several windows if we have several frames.
385 //we also need to check that the xwidget is to be drawn inside a window on a frame where it originaly lives.
386 //otherwise draw a phantom, or maybe reparent the xwidget.
387
373 struct xwidget *xw = &xwidgets[s->xwidget_id]; 388 struct xwidget *xw = &xwidgets[s->xwidget_id];
374 int clipx; int clipy; 389 int clipx; int clipy;
375 390
@@ -920,7 +935,6 @@ xwidget_end_redisplay (struct glyph_matrix *matrix)
920 xwidget_hide (xw); 935 xwidget_hide (xw);
921 } 936 }
922 } 937 }
923
924} 938}
925 939
926/* some type of modification was made to the buffers*/ 940/* some type of modification was made to the buffers*/