Don't define BEGIN_INTERFACE in unknwn.h.
[wine] / dlls / x11drv / mouse.c
1 /*
2  * X11 mouse driver
3  *
4  * Copyright 1998 Ulrich Weigand
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "config.h"
22
23 #include <X11/Xlib.h>
24 #ifdef HAVE_LIBXXF86DGA2
25 #include <X11/extensions/xf86dga.h>
26 #endif
27 #include <stdarg.h>
28
29 #define NONAMELESSUNION
30 #define NONAMELESSSTRUCT
31 #include "windef.h"
32 #include "winbase.h"
33 #include "wine/winuser16.h"
34
35 #include "x11drv.h"
36 #include "wine/debug.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(cursor);
39
40 /**********************************************************************/
41
42 #define NB_BUTTONS   5     /* Windows can handle 3 buttons and the wheel too */
43
44 static const UINT button_down_flags[NB_BUTTONS] =
45 {
46     MOUSEEVENTF_LEFTDOWN,
47     MOUSEEVENTF_MIDDLEDOWN,
48     MOUSEEVENTF_RIGHTDOWN,
49     MOUSEEVENTF_WHEEL,
50     MOUSEEVENTF_WHEEL
51 };
52
53 static const UINT button_up_flags[NB_BUTTONS] =
54 {
55     MOUSEEVENTF_LEFTUP,
56     MOUSEEVENTF_MIDDLEUP,
57     MOUSEEVENTF_RIGHTUP,
58     0,
59     0
60 };
61
62 static BYTE *pKeyStateTable;
63
64
65 /***********************************************************************
66  *              get_coords
67  *
68  * get the coordinates of a mouse event
69  */
70 static void get_coords( HWND *hwnd, Window window, int x, int y, POINT *pt )
71 {
72     struct x11drv_win_data *data;
73     WND *win;
74
75     if (!(win = WIN_GetPtr( *hwnd )) || win == WND_OTHER_PROCESS) return;
76     data = win->pDriverData;
77
78     if (window == data->whole_window)
79     {
80         x -= data->client_rect.left;
81         y -= data->client_rect.top;
82     }
83     WIN_ReleasePtr( win );
84
85     pt->x = x;
86     pt->y = y;
87     if (*hwnd != GetDesktopWindow())
88     {
89         ClientToScreen( *hwnd, pt );
90         *hwnd = GetAncestor( *hwnd, GA_ROOT );
91     }
92 }
93
94
95 /***********************************************************************
96  *              update_button_state
97  *
98  * Update the button state with what X provides us
99  */
100 static void update_button_state( unsigned int state )
101 {
102     pKeyStateTable[VK_LBUTTON] = (state & Button1Mask ? 0x80 : 0);
103     pKeyStateTable[VK_MBUTTON] = (state & Button2Mask ? 0x80 : 0);
104     pKeyStateTable[VK_RBUTTON] = (state & Button3Mask ? 0x80 : 0);
105 }
106
107
108 /***********************************************************************
109  *              update_key_state
110  *
111  * Update the key state with what X provides us
112  */
113 static void update_key_state( unsigned int state )
114 {
115     pKeyStateTable[VK_SHIFT]   = (state & ShiftMask   ? 0x80 : 0);
116     pKeyStateTable[VK_CONTROL] = (state & ControlMask ? 0x80 : 0);
117 }
118
119
120 /***********************************************************************
121  *              send_mouse_event
122  */
123 static void send_mouse_event( HWND hwnd, DWORD flags, DWORD posX, DWORD posY,
124                               DWORD data, Time time )
125 {
126     INPUT input;
127
128     TRACE("(%04lX,%ld,%ld)\n", flags, posX, posY );
129
130     if (flags & MOUSEEVENTF_ABSOLUTE)
131     {
132         int width  = GetSystemMetrics( SM_CXSCREEN );
133         int height = GetSystemMetrics( SM_CYSCREEN );
134         /* Relative mouse movements seem not to be scaled as absolute ones */
135         posX = (((long)posX << 16) + width-1)  / width;
136         posY = (((long)posY << 16) + height-1) / height;
137     }
138
139     input.type             = WINE_INTERNAL_INPUT_MOUSE;
140     input.u.mi.dx          = posX;
141     input.u.mi.dy          = posY;
142     input.u.mi.mouseData   = data;
143     input.u.mi.dwFlags     = flags;
144     input.u.mi.time        = time - X11DRV_server_startticks;
145     input.u.mi.dwExtraInfo = (ULONG_PTR)hwnd;
146     SendInput( 1, &input, sizeof(input) );
147 }
148
149
150 /***********************************************************************
151  *              update_cursor
152  *
153  * Update the cursor of a window on a mouse event.
154  */
155 static void update_cursor( HWND hwnd, Window win )
156 {
157     struct x11drv_thread_data *data = x11drv_thread_data();
158
159     if (win == X11DRV_get_client_window( hwnd ))
160         win = X11DRV_get_whole_window( hwnd );  /* always set cursor on whole window */
161
162     if (data->cursor_window != win)
163     {
164         data->cursor_window = win;
165         wine_tsx11_lock();
166         if (data->cursor) XDefineCursor( data->display, win, data->cursor );
167         wine_tsx11_unlock();
168     }
169 }
170
171
172 /***********************************************************************
173  *              create_cursor
174  *
175  * Create an X cursor from a Windows one.
176  */
177 static Cursor create_cursor( Display *display, CURSORICONINFO *ptr )
178 {
179     Pixmap pixmapBits, pixmapMask, pixmapMaskInv, pixmapAll;
180     XColor fg, bg;
181     Cursor cursor = None;
182
183     if (!ptr)  /* Create an empty cursor */
184     {
185         static const char data[] = { 0 };
186
187         bg.red = bg.green = bg.blue = 0x0000;
188         pixmapBits = XCreateBitmapFromData( display, root_window, data, 1, 1 );
189         if (pixmapBits)
190         {
191             cursor = XCreatePixmapCursor( display, pixmapBits, pixmapBits,
192                                           &bg, &bg, 0, 0 );
193             XFreePixmap( display, pixmapBits );
194         }
195     }
196     else  /* Create the X cursor from the bits */
197     {
198         XImage *image;
199         GC gc;
200
201         TRACE("Bitmap %dx%d planes=%d bpp=%d bytesperline=%d\n",
202             ptr->nWidth, ptr->nHeight, ptr->bPlanes, ptr->bBitsPerPixel,
203             ptr->nWidthBytes);
204         /* Create a pixmap and transfer all the bits to it */
205
206         /* NOTE: Following hack works, but only because XFree depth
207          *       1 images really use 1 bit/pixel (and so the same layout
208          *       as the Windows cursor data). Perhaps use a more generic
209          *       algorithm here.
210          */
211         /* This pixmap will be written with two bitmaps. The first is
212          *  the mask and the second is the image.
213          */
214         if (!(pixmapAll = XCreatePixmap( display, root_window,
215                   ptr->nWidth, ptr->nHeight * 2, 1 )))
216             return 0;
217         if (!(image = XCreateImage( display, visual,
218                 1, ZPixmap, 0, (char *)(ptr + 1), ptr->nWidth,
219                 ptr->nHeight * 2, 16, ptr->nWidthBytes/ptr->bBitsPerPixel)))
220         {
221             XFreePixmap( display, pixmapAll );
222             return 0;
223         }
224         gc = XCreateGC( display, pixmapAll, 0, NULL );
225         XSetGraphicsExposures( display, gc, False );
226         image->byte_order = MSBFirst;
227         image->bitmap_bit_order = MSBFirst;
228         image->bitmap_unit = 16;
229         _XInitImageFuncPtrs(image);
230         if (ptr->bPlanes * ptr->bBitsPerPixel == 1)
231         {
232             /* A plain old white on black cursor. */
233             fg.red = fg.green = fg.blue = 0xffff;
234             bg.red = bg.green = bg.blue = 0x0000;
235             XPutImage( display, pixmapAll, gc, image,
236                 0, 0, 0, 0, ptr->nWidth, ptr->nHeight * 2 );
237         }
238         else
239         {
240             int     rbits, gbits, bbits, red, green, blue;
241             int     rfg, gfg, bfg, rbg, gbg, bbg;
242             int     rscale, gscale, bscale;
243             int     x, y, xmax, ymax, bitIndex, byteIndex, xorIndex;
244             unsigned char *theMask, *theImage, theChar;
245             int     threshold, fgBits, bgBits, bitShifted;
246             BYTE    pXorBits[128];   /* Up to 32x32 icons */
247
248             switch (ptr->bBitsPerPixel)
249             {
250             case 24:
251                 rbits = 8;
252                 gbits = 8;
253                 bbits = 8;
254                 threshold = 0x40;
255                 break;
256             case 16:
257                 rbits = 5;
258                 gbits = 6;
259                 bbits = 5;
260                 threshold = 0x40;
261                 break;
262             default:
263                 FIXME("Currently no support for cursors with %d bits per pixel\n",
264                   ptr->bBitsPerPixel);
265                 XFreePixmap( display, pixmapAll );
266                 XFreeGC( display, gc );
267                 image->data = NULL;
268                 XDestroyImage( image );
269                 return 0;
270             }
271             /* The location of the mask. */
272             theMask = (char *)(ptr + 1);
273             /* The mask should still be 1 bit per pixel. The color image
274              * should immediately follow the mask.
275              */
276             theImage = &theMask[ptr->nWidth/8 * ptr->nHeight];
277             rfg = gfg = bfg = rbg = gbg = bbg = 0;
278             bitIndex = 0;
279             byteIndex = 0;
280             xorIndex = 0;
281             fgBits = 0;
282             bitShifted = 0x01;
283             xmax = (ptr->nWidth > 32) ? 32 : ptr->nWidth;
284             if (ptr->nWidth > 32) {
285                 ERR("Got a %dx%d cursor. Cannot handle larger than 32x32.\n",
286                   ptr->nWidth, ptr->nHeight);
287             }
288             ymax = (ptr->nHeight > 32) ? 32 : ptr->nHeight;
289
290             memset(pXorBits, 0, 128);
291             for (y=0; y<ymax; y++)
292             {
293                 for (x=0; x<xmax; x++)
294                 {
295                         red = green = blue = 0;
296                         switch (ptr->bBitsPerPixel)
297                         {
298                         case 24:
299                             theChar = theImage[byteIndex++];
300                             blue = theChar;
301                             theChar = theImage[byteIndex++];
302                             green = theChar;
303                             theChar = theImage[byteIndex++];
304                             red = theChar;
305                             break;
306                         case 16:
307                             theChar = theImage[byteIndex++];
308                             blue = theChar & 0x1F;
309                             green = (theChar & 0xE0) >> 5;
310                             theChar = theImage[byteIndex++];
311                             green |= (theChar & 0x07) << 3;
312                             red = (theChar & 0xF8) >> 3;
313                             break;
314                         }
315
316                     if (red+green+blue > threshold)
317                     {
318                         rfg += red;
319                         gfg += green;
320                         bfg += blue;
321                         fgBits++;
322                         pXorBits[xorIndex] |= bitShifted;
323                     }
324                     else
325                     {
326                         rbg += red;
327                         gbg += green;
328                         bbg += blue;
329                     }
330                     if (x%8 == 7)
331                     {
332                         bitShifted = 0x01;
333                         xorIndex++;
334                     }
335                     else
336                         bitShifted = bitShifted << 1;
337                 }
338             }
339             rscale = 1 << (16 - rbits);
340             gscale = 1 << (16 - gbits);
341             bscale = 1 << (16 - bbits);
342             if (fgBits)
343             {
344                 fg.red   = rfg * rscale / fgBits;
345                 fg.green = gfg * gscale / fgBits;
346                 fg.blue  = bfg * bscale / fgBits;
347             }
348             else fg.red = fg.green = fg.blue = 0;
349             bgBits = xmax * ymax - fgBits;
350             if (bgBits)
351             {
352                 bg.red   = rbg * rscale / bgBits;
353                 bg.green = gbg * gscale / bgBits;
354                 bg.blue  = bbg * bscale / bgBits;
355             }
356             else bg.red = bg.green = bg.blue = 0;
357             pixmapBits = XCreateBitmapFromData( display, root_window, pXorBits, xmax, ymax );
358             if (!pixmapBits)
359             {
360                 XFreePixmap( display, pixmapAll );
361                 XFreeGC( display, gc );
362                 image->data = NULL;
363                 XDestroyImage( image );
364                 return 0;
365             }
366
367             /* Put the mask. */
368             XPutImage( display, pixmapAll, gc, image,
369                    0, 0, 0, 0, ptr->nWidth, ptr->nHeight );
370             XSetFunction( display, gc, GXcopy );
371             /* Put the image */
372             XCopyArea( display, pixmapBits, pixmapAll, gc,
373                        0, 0, xmax, ymax, 0, ptr->nHeight );
374             XFreePixmap( display, pixmapBits );
375         }
376         image->data = NULL;
377         XDestroyImage( image );
378
379         /* Now create the 2 pixmaps for bits and mask */
380
381         pixmapBits = XCreatePixmap( display, root_window, ptr->nWidth, ptr->nHeight, 1 );
382         pixmapMask = XCreatePixmap( display, root_window, ptr->nWidth, ptr->nHeight, 1 );
383         pixmapMaskInv = XCreatePixmap( display, root_window, ptr->nWidth, ptr->nHeight, 1 );
384
385         /* Make sure everything went OK so far */
386
387         if (pixmapBits && pixmapMask && pixmapMaskInv)
388         {
389             POINT hotspot;
390
391             /* We have to do some magic here, as cursors are not fully
392              * compatible between Windows and X11. Under X11, there
393              * are only 3 possible color cursor: black, white and
394              * masked. So we map the 4th Windows color (invert the
395              * bits on the screen) to black and an additional white bit on
396              * an other place (+1,+1). This require some boolean arithmetic:
397              *
398              *         Windows          |          X11
399              * And    Xor      Result   |   Bits     Mask     Result
400              *  0      0     black      |    0        1     background
401              *  0      1     white      |    1        1     foreground
402              *  1      0     no change  |    X        0     no change
403              *  1      1     inverted   |    0        1     background
404              *
405              * which gives:
406              *  Bits = not 'And' and 'Xor' or 'And2' and 'Xor2'
407              *  Mask = not 'And' or 'Xor' or 'And2' and 'Xor2'
408              *
409              * FIXME: apparently some servers do support 'inverted' color.
410              * I don't know if it's correct per the X spec, but maybe
411              * we ought to take advantage of it.  -- AJ
412              */
413             XSetFunction( display, gc, GXcopy );
414             XCopyArea( display, pixmapAll, pixmapBits, gc,
415                        0, 0, ptr->nWidth, ptr->nHeight, 0, 0 );
416             XCopyArea( display, pixmapAll, pixmapMask, gc,
417                        0, 0, ptr->nWidth, ptr->nHeight, 0, 0 );
418             XCopyArea( display, pixmapAll, pixmapMaskInv, gc,
419                        0, 0, ptr->nWidth, ptr->nHeight, 0, 0 );
420             XSetFunction( display, gc, GXand );
421             XCopyArea( display, pixmapAll, pixmapMaskInv, gc,
422                        0, ptr->nHeight, ptr->nWidth, ptr->nHeight, 0, 0 );
423             XSetFunction( display, gc, GXandReverse );
424             XCopyArea( display, pixmapAll, pixmapBits, gc,
425                        0, ptr->nHeight, ptr->nWidth, ptr->nHeight, 0, 0 );
426             XSetFunction( display, gc, GXorReverse );
427             XCopyArea( display, pixmapAll, pixmapMask, gc,
428                        0, ptr->nHeight, ptr->nWidth, ptr->nHeight, 0, 0 );
429             /* Additional white */
430             XSetFunction( display, gc, GXor );
431             XCopyArea( display, pixmapMaskInv, pixmapMask, gc,
432                        0, 0, ptr->nWidth, ptr->nHeight, 1, 1 );
433             XCopyArea( display, pixmapMaskInv, pixmapBits, gc,
434                        0, 0, ptr->nWidth, ptr->nHeight, 1, 1 );
435             XSetFunction( display, gc, GXcopy );
436
437             /* Make sure hotspot is valid */
438             hotspot.x = ptr->ptHotSpot.x;
439             hotspot.y = ptr->ptHotSpot.y;
440             if (hotspot.x < 0 || hotspot.x >= ptr->nWidth ||
441                 hotspot.y < 0 || hotspot.y >= ptr->nHeight)
442             {
443                 hotspot.x = ptr->nWidth / 2;
444                 hotspot.y = ptr->nHeight / 2;
445             }
446             cursor = XCreatePixmapCursor( display, pixmapBits, pixmapMask,
447                                           &fg, &bg, hotspot.x, hotspot.y );
448         }
449
450         /* Now free everything */
451
452         if (pixmapAll) XFreePixmap( display, pixmapAll );
453         if (pixmapBits) XFreePixmap( display, pixmapBits );
454         if (pixmapMask) XFreePixmap( display, pixmapMask );
455         if (pixmapMaskInv) XFreePixmap( display, pixmapMaskInv );
456         XFreeGC( display, gc );
457     }
458     return cursor;
459 }
460
461
462 /***********************************************************************
463  *              SetCursor (X11DRV.@)
464  */
465 void X11DRV_SetCursor( CURSORICONINFO *lpCursor )
466 {
467     Cursor cursor;
468
469     if (root_window != DefaultRootWindow(gdi_display))
470     {
471         /* If in desktop mode, set the cursor on the desktop window */
472
473         wine_tsx11_lock();
474         cursor = create_cursor( gdi_display, lpCursor );
475         if (cursor)
476         {
477             XDefineCursor( gdi_display, root_window, cursor );
478             /* Make the change take effect immediately */
479             XFlush(gdi_display);
480             XFreeCursor( gdi_display, cursor );
481         }
482         wine_tsx11_unlock();
483     }
484     else /* set the same cursor for all top-level windows of the current thread */
485     {
486         struct x11drv_thread_data *data = x11drv_thread_data();
487
488         wine_tsx11_lock();
489         cursor = create_cursor( data->display, lpCursor );
490         if (cursor)
491         {
492             if (data->cursor) XFreeCursor( data->display, data->cursor );
493             data->cursor = cursor;
494             if (data->cursor_window)
495             {
496                 XDefineCursor( data->display, data->cursor_window, cursor );
497                 /* Make the change take effect immediately */
498                 XFlush( data->display );
499             }
500         }
501         wine_tsx11_unlock();
502     }
503 }
504
505 /***********************************************************************
506  *              SetCursorPos (X11DRV.@)
507  */
508 void X11DRV_SetCursorPos( INT x, INT y )
509 {
510     Display *display = thread_display();
511
512     TRACE( "warping to (%d,%d)\n", x, y );
513
514     wine_tsx11_lock();
515     XWarpPointer( display, root_window, root_window, 0, 0, 0, 0, x, y );
516     XFlush( display ); /* just in case */
517     wine_tsx11_unlock();
518 }
519
520 /***********************************************************************
521  *              GetCursorPos (X11DRV.@)
522  */
523 void X11DRV_GetCursorPos(LPPOINT pos)
524 {
525   Display *display = thread_display();
526   Window root, child;
527   int rootX, rootY, winX, winY;
528   unsigned int xstate;
529
530   wine_tsx11_lock();
531   if (XQueryPointer( display, root_window, &root, &child,
532                      &rootX, &rootY, &winX, &winY, &xstate ))
533   {
534       update_key_state( xstate );
535       update_button_state( xstate );
536       TRACE("pointer at (%d,%d)\n", winX, winY );
537       pos->x = winX;
538       pos->y = winY;
539   }
540   wine_tsx11_unlock();
541 }
542
543 /***********************************************************************
544  *              InitMouse (X11DRV.@)
545  */
546 void X11DRV_InitMouse( BYTE *key_state_table )
547 {
548     pKeyStateTable = key_state_table;
549 }
550
551
552 /***********************************************************************
553  *           X11DRV_ButtonPress
554  */
555 void X11DRV_ButtonPress( HWND hwnd, XButtonEvent *event )
556 {
557     int buttonNum = event->button - 1;
558     WORD wData = 0;
559     POINT pt;
560
561     if (buttonNum >= NB_BUTTONS) return;
562     if (!hwnd) return;
563
564     update_cursor( hwnd, event->window );
565     get_coords( &hwnd, event->window, event->x, event->y, &pt );
566
567     switch (buttonNum)
568     {
569     case 3:
570         wData = WHEEL_DELTA;
571         break;
572     case 4:
573         wData = -WHEEL_DELTA;
574         break;
575     }
576     update_key_state( event->state );
577     send_mouse_event( hwnd, button_down_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE,
578                       pt.x, pt.y, wData, event->time );
579 }
580
581
582 /***********************************************************************
583  *           X11DRV_ButtonRelease
584  */
585 void X11DRV_ButtonRelease( HWND hwnd, XButtonEvent *event )
586 {
587     int buttonNum = event->button - 1;
588     POINT pt;
589
590     if (buttonNum >= NB_BUTTONS || !button_up_flags[buttonNum]) return;
591     if (!hwnd) return;
592
593     update_cursor( hwnd, event->window );
594     get_coords( &hwnd, event->window, event->x, event->y, &pt );
595     update_key_state( event->state );
596     send_mouse_event( hwnd, button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE,
597                       pt.x, pt.y, 0, event->time );
598 }
599
600
601 /***********************************************************************
602  *           X11DRV_MotionNotify
603  */
604 void X11DRV_MotionNotify( HWND hwnd, XMotionEvent *event )
605 {
606     POINT pt;
607
608     if (!hwnd) return;
609
610     update_cursor( hwnd, event->window );
611     get_coords( &hwnd, event->window, event->x, event->y, &pt );
612     update_key_state( event->state );
613     send_mouse_event( hwnd, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
614                       pt.x, pt.y, 0, event->time );
615 }
616
617
618 /***********************************************************************
619  *           X11DRV_EnterNotify
620  */
621 void X11DRV_EnterNotify( HWND hwnd, XCrossingEvent *event )
622 {
623     POINT pt;
624
625     if (event->detail == NotifyVirtual || event->detail == NotifyNonlinearVirtual) return;
626     if (!hwnd) return;
627
628     /* simulate a mouse motion event */
629     update_cursor( hwnd, event->window );
630     get_coords( &hwnd, event->window, event->x, event->y, &pt );
631     update_key_state( event->state );
632     send_mouse_event( hwnd, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
633                       pt.x, pt.y, 0, event->time );
634 }
635
636
637 #ifdef HAVE_LIBXXF86DGA2
638 /**********************************************************************
639  *              X11DRV_DGAMotionEvent
640  */
641 void X11DRV_DGAMotionEvent( HWND hwnd, XDGAMotionEvent *event )
642 {
643     update_key_state( event->state );
644     send_mouse_event( hwnd, MOUSEEVENTF_MOVE, event->dx, event->dy, 0, event->time );
645 }
646
647 /**********************************************************************
648  *              X11DRV_DGAButtonPressEvent
649  */
650 void X11DRV_DGAButtonPressEvent( HWND hwnd, XDGAButtonEvent *event )
651 {
652     int buttonNum = event->button - 1;
653
654     if (buttonNum >= NB_BUTTONS) return;
655     update_key_state( event->state );
656     send_mouse_event( hwnd, button_down_flags[buttonNum], 0, 0, 0, event->time );
657 }
658
659 /**********************************************************************
660  *              X11DRV_DGAButtonReleaseEvent
661  */
662 void X11DRV_DGAButtonReleaseEvent( HWND hwnd, XDGAButtonEvent *event )
663 {
664     int buttonNum = event->button - 1;
665
666     if (buttonNum >= NB_BUTTONS) return;
667     update_key_state( event->state );
668     send_mouse_event( hwnd, button_up_flags[buttonNum], 0, 0, 0, event->time );
669 }
670 #endif /* HAVE_LIBXXF86DGA2 */