Close the right window when clicking on a non active window close
[wine/dcerpc.git] / graphics / x11drv / objects.c
blob497abe1a6b2f852996a16c34d55ab3c53f140721
1 /*
2 * GDI objects
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include "config.h"
9 #ifndef X_DISPLAY_MISSING
11 #include <stdlib.h>
12 #include <stdio.h>
13 #include "bitmap.h"
14 #include "brush.h"
15 #include "font.h"
16 #include "pen.h"
17 #include "local.h"
18 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(gdi)
23 extern HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
24 BITMAPOBJ * bmp );
25 extern HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush,
26 BRUSHOBJ * brush );
27 extern HFONT X11DRV_FONT_SelectObject( DC * dc, HFONT hfont,
28 FONTOBJ * font );
29 extern HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen );
31 extern BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ *bmp );
33 /***********************************************************************
34 * X11DRV_SelectObject
36 HGDIOBJ X11DRV_SelectObject( DC *dc, HGDIOBJ handle )
38 GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
39 HGDIOBJ ret = 0;
41 if (!ptr) return 0;
42 TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
44 switch(ptr->wMagic)
46 case PEN_MAGIC:
47 ret = X11DRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
48 break;
49 case BRUSH_MAGIC:
50 ret = X11DRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
51 break;
52 case BITMAP_MAGIC:
53 ret = X11DRV_BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
54 break;
55 case FONT_MAGIC:
56 ret = X11DRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
57 break;
58 case REGION_MAGIC:
59 ret = (HGDIOBJ16)SelectClipRgn16( dc->hSelf, handle );
60 break;
62 GDI_HEAP_UNLOCK( handle );
63 return ret;
67 /***********************************************************************
68 * X11DRV_DeleteObject
70 BOOL X11DRV_DeleteObject( HGDIOBJ handle )
72 GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
73 BOOL ret = 0;
75 if (!ptr) return FALSE;
77 switch(ptr->wMagic) {
78 case BITMAP_MAGIC:
79 ret = X11DRV_BITMAP_DeleteObject( handle, (BITMAPOBJ *)ptr );
80 break;
82 default:
83 ERR("Shouldn't be here!\n");
84 ret = FALSE;
85 break;
87 GDI_HEAP_UNLOCK( handle );
88 return ret;
91 #endif /* !defined(X_DISPLAY_MISSING) */