~ubuntu-branches/ubuntu/maverick/boinc/maverick

« back to all changes in this revision

Viewing changes to samples/glut/win32_util.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Hahler, Daniel Hahler, Steffen Moeller
  • Date: 2010-07-17 22:08:09 UTC
  • mfrom: (1.1.16 upstream) (6.2.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100717220809-6tldfdolji3p7y6r
Tags: 6.10.58+dfsg-2
[ Daniel Hahler ]
* Use chrt instead of schedtool (LP: #527639)
  - debian/control, debian/boinc-client.init
[ Steffen Moeller ]
* Removed from source tree for DFSG compliance
  - samples/glut
* Adopted source format 3.0 (quilt)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/* Copyright (c) Nate Robins, 1997. */
3
 
 
4
 
/* portions Copyright (c) Mark Kilgard, 1997, 1998. */
5
 
 
6
 
/* This program is freely distributable without licensing fees 
7
 
   and is provided without guarantee or warrantee expressed or 
8
 
   implied. This program is -not- in the public domain. */
9
 
 
10
 
 
11
 
#include "glutint.h"
12
 
#include "glutstroke.h"
13
 
#include "glutbitmap.h"
14
 
 
15
 
extern StrokeFontRec glutStrokeRoman;
16
 
 
17
 
/* To get around the fact that Microsoft DLLs only allow functions
18
 
   to be exported and now data addresses (as Unix DSOs support), the
19
 
   GLUT API constants such as GLUT_STROKE_ROMAN have to get passed
20
 
   through a case statement to get mapped to the actual data structure
21
 
   address. */
22
 
void*
23
 
__glutFont(void *font)
24
 
{
25
 
  switch (*reinterpret_cast<size_t *>(&font)) {
26
 
#ifdef __MINGW32__
27
 
  case 0:
28
 
#else
29
 
  case (size_t)GLUT_STROKE_ROMAN:
30
 
#endif
31
 
    return &glutStrokeRoman;
32
 
  }
33
 
  return &glutStrokeRoman;
34
 
}
35
 
 
36
 
int
37
 
__glutGetTransparentPixel(Display * dpy, XVisualInfo * vinfo)
38
 
{
39
 
  /* the transparent pixel on Win32 is always index number 0.  So if
40
 
     we put this routine in this file, we can avoid compiling the
41
 
     whole of layerutil.c which is where this routine normally comes
42
 
     from. */
43
 
  return 0;
44
 
}
45
 
 
46
 
void
47
 
__glutAdjustCoords(Window parent, int* x, int* y, int* width, int* height)
48
 
{
49
 
  RECT rect;
50
 
 
51
 
  /* adjust the window rectangle because Win32 thinks that the x, y,
52
 
     width & height are the WHOLE window (including decorations),
53
 
     whereas GLUT treats the x, y, width & height as only the CLIENT
54
 
     area of the window. */
55
 
  rect.left = *x; rect.top = *y;
56
 
  rect.right = *x + *width; rect.bottom = *y + *height;
57
 
 
58
 
  /* must adjust the coordinates according to the correct style
59
 
     because depending on the style, there may or may not be
60
 
     borders. */
61
 
  AdjustWindowRect(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
62
 
                   (parent ? WS_CHILD : WS_OVERLAPPEDWINDOW),
63
 
                   FALSE);
64
 
  /* FALSE in the third parameter = window has no menu bar */
65
 
 
66
 
  /* readjust if the x and y are offscreen */
67
 
  if(rect.left < 0) {
68
 
    *x = 0;
69
 
  } else {
70
 
    *x = rect.left;
71
 
  }
72
 
  
73
 
  if(rect.top < 0) {
74
 
    *y = 0;
75
 
  } else {
76
 
    *y = rect.top;
77
 
  }
78
 
 
79
 
  *width = rect.right - rect.left;      /* adjusted width */
80
 
  *height = rect.bottom - rect.top;     /* adjusted height */
81
 
}
82