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

[mgp-users-jp 01379] Re: 1.11aのリリース



From: Kenichi Handa <handa@m17n.org>
Subject: [mgp-users-jp 01378] Re: 1.11aのリリース
Date: Tue, 31 Aug 2004 13:09:42 +0900 (JST)
Message-ID: <>

 > > それでうまくいきそうですね。 cutinの機能はあんまり人気が無い様で
 > > リクエストがなかったのと、僕自身もまったく使わないので長いこと
 > > 手をつけてませんでした。ちょっと考えてみます。
 > 
 > ちょっと気をつけなければいけないのは、 -o で起動した上で mgp 
 > の window の一部をスクリーンから外に出している状態だと、
 > XGetImage が BadMatch (だっけな?)のエラーを起こすことです。
 > このエラーを避けようとするとちょっと面倒なので、上記のような
 > 場合だけは、現在のコードを使うようにするのが良いと思います。
 > どうせ実際のプレゼンの場ではそんな状況にはならないはずなので。

なるほど。こんな感じにしてみました。
--
西田佳史
Yoshifumi Nishida
nishida@csl.sony.co.jp

diff -c -r1.221 draw.c
*** draw.c	19 Aug 2004 16:28:57 -0000	1.221
--- draw.c	31 Aug 2004 18:02:16 -0000
***************
*** 1048,1062 ****
  	int dir;
  {
  	u_int step, x, xoff, yoff;
! 	int i;
! 	int sx;
! 	int round;
! 	Window cutinWin;
! 
! #ifdef USE_M17N
! 	// we cannot use cutin with m17n-lib so far.
! 	return;
! #endif
  
  	if (state->repaint)
  		return;
--- 1048,1058 ----
  	int dir;
  {
  	u_int step, x, xoff, yoff;
! 	int i, sx, round;
! 	int root_x, root_y, use_copy;
! 	Window cutinWin, junkwin;
! 	XImage *copywin; 
! 	static XWindowAttributes xa;
  
  	if (state->repaint)
  		return;
***************
*** 1064,1069 ****
--- 1060,1073 ----
  	if (!state->linewidth)
  		return;
  
+ 	if (!xa.width) 
+ 		XGetWindowAttributes(display, DefaultRootWindow(display), &xa);
+ 	XTranslateCoordinates(display, window, DefaultRootWindow(display), 
+ 		0, 0, &root_x ,&root_y, &junkwin);
+ 	use_copy = 1;
+ 	if ((root_x + window_width > xa.width) || (root_y + window_height > xa.height))
+ 		use_copy = 0;
+ 
  	sx = (0 < dir) ? 0 : state->width - state->linewidth;
  	round = 20;	/*XXX*/
  #ifndef abs
***************
*** 1082,1097 ****
--- 1086,1112 ----
  	XSetWindowBackgroundPixmap(display, cutinWin, None);
  	XMapSubwindows(display, state->target);
  
+ 	if (use_copy) copywin = XGetImage(display, window, 0, 0, 
+ 						window_width, window_height, AllPlanes, ZPixmap);
+ 
  	xoff = state->xoff;	
  	yoff = state->yoff;	
  	state->xoff = state->yoff = 0;
  	if (state->obj) {
+ 		if (use_copy) XPutImage(display, cutinWin, gc_cache, copywin, 
+ 						x + xoff, ly + yoff, 0, 0,
+ 						state->linewidth, state->maxascent + state->maxdescent);
  		obj_draw(state, cutinWin, 0, 0);
  	}
  	XFlush(display);
  
  	x = sx;
  	for (i = 0; i < round; i++) {
+ 		if (use_copy && state->obj) {
+ 			XPutImage(display, cutinWin, gc_cache, copywin, x + xoff, ly + yoff, 0, 0,
+ 				state->linewidth, state->maxascent + state->maxdescent);
+ 			obj_draw(state, cutinWin, 0, 0);
+ 		}
  		XMoveWindow(display, cutinWin, x + xoff, ly + yoff);
  		XFlush(display);
  		usleep(CUTIN_DELAY);