summaryrefslogtreecommitdiff
path: root/src/drivers/WinAPI
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/WinAPI')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx30
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H14
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx102
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_System_Driver.H10
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx114
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H16
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx40
7 files changed, 142 insertions, 184 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx
index 59c15685f..2e808f1f5 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// Printing support for Windows for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2020 by Bill Spitzak and others.
@@ -11,9 +9,9 @@
//
// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// https://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
#include "../GDI/Fl_GDI_Graphics_Driver.H"
@@ -72,12 +70,12 @@ Fl_WinAPI_Printer_Driver::~Fl_WinAPI_Printer_Driver(void) {
static void WIN_SetupPrinterDeviceContext(HDC prHDC)
{
if ( !prHDC ) return;
-
+
fl_window = 0;
SetGraphicsMode(prHDC, GM_ADVANCED); // to allow for rotations
SetMapMode(prHDC, MM_ANISOTROPIC);
SetTextAlign(prHDC, TA_BASELINE|TA_LEFT);
- SetBkMode(prHDC, TRANSPARENT);
+ SetBkMode(prHDC, TRANSPARENT);
// this matches 720 logical units to the number of device units in 10 inches of paper
// thus the logical unit is the point (= 1/72 inch)
SetWindowExtEx(prHDC, 720, 720, NULL);
@@ -92,7 +90,7 @@ int Fl_WinAPI_Printer_Driver::begin_job (int pagecount, int *frompage, int *topa
DOCINFO di;
char docName [256];
int err = 0;
-
+
abortPrint = FALSE;
memset (&pd, 0, sizeof (PRINTDLG));
pd.lStructSize = sizeof (PRINTDLG);
@@ -166,7 +164,7 @@ void Fl_WinAPI_Printer_Driver::end_job (void)
if (! abortPrint) {
prerr = EndDoc (hPr);
if (prerr < 0) {
- fl_alert ("EndDoc error %d", prerr);
+ fl_alert ("EndDoc error %d", prerr);
}
}
DeleteDC (hPr);
@@ -184,14 +182,14 @@ void Fl_WinAPI_Printer_Driver::absolute_printable_rect(int *x, int *y, int *w, i
{
POINT physPageSize;
POINT pixelsPerInch;
- XFORM transform;
-
+ XFORM transform;
+
if (hPr == NULL) return;
HDC gc = (HDC)driver()->gc();
GetWorldTransform(gc, &transform);
ModifyWorldTransform(gc, NULL, MWT_IDENTITY);
SetWindowOrgEx(gc, 0, 0, NULL);
-
+
physPageSize.x = GetDeviceCaps(hPr, HORZRES);
physPageSize.y = GetDeviceCaps(hPr, VERTRES);
DPtoLP(hPr, &physPageSize, 1);
@@ -204,7 +202,7 @@ void Fl_WinAPI_Printer_Driver::absolute_printable_rect(int *x, int *y, int *w, i
*w -= (pixelsPerInch.x / 2);
top_margin = (pixelsPerInch.y / 4);
*h -= (pixelsPerInch.y / 2);
-
+
*x = left_margin;
*y = top_margin;
origin(x_offset, y_offset);
@@ -231,7 +229,7 @@ int Fl_WinAPI_Printer_Driver::printable_rect(int *w, int *h)
int Fl_WinAPI_Printer_Driver::begin_page (void)
{
int rsult, w, h;
-
+
rsult = 0;
if (hPr != NULL) {
WIN_SetupPrinterDeviceContext (hPr);
@@ -279,7 +277,7 @@ void Fl_WinAPI_Printer_Driver::rotate (float rot_angle)
int Fl_WinAPI_Printer_Driver::end_page (void)
{
int rsult;
-
+
rsult = 0;
if (hPr != NULL) {
prerr = EndPage (hPr);
@@ -332,7 +330,3 @@ void Fl_WinAPI_Printer_Driver::origin(int *x, int *y)
{
Fl_Paged_Device::origin(x, y);
}
-
-//
-// End of "$Id$".
-//
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H
index 11a923331..2964375f1 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// Definition of Windows screen interface
// for the Fast Light Tool Kit (FLTK).
//
@@ -10,11 +8,11 @@
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
-// http://www.fltk.org/COPYING.php
+// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// http://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
/**
@@ -31,7 +29,7 @@
class Fl_Window;
-class FL_EXPORT Fl_WinAPI_Screen_Driver : public Fl_Screen_Driver
+class FL_EXPORT Fl_WinAPI_Screen_Driver : public Fl_Screen_Driver
{
protected:
RECT screens[MAX_SCREENS];
@@ -97,7 +95,3 @@ public:
#endif // FL_WINAPI_SCREEN_DRIVER_H
-
-//
-// End of "$Id$".
-//
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
index f87ae8df3..f65404922 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// Windows screen interface for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2018 by Bill Spitzak and others.
@@ -9,11 +7,11 @@
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
-// http://www.fltk.org/COPYING.php
+// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// http://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
@@ -315,10 +313,10 @@ static void getsyscolor(int what, const char* arg, void (*func)(uchar,uchar,ucha
void Fl_WinAPI_Screen_Driver::get_system_colors()
{
- if (!bg2_set) getsyscolor(COLOR_WINDOW, fl_bg2,Fl::background2);
- if (!fg_set) getsyscolor(COLOR_WINDOWTEXT, fl_fg, Fl::foreground);
- if (!bg_set) getsyscolor(COLOR_BTNFACE, fl_bg, Fl::background);
- getsyscolor(COLOR_HIGHLIGHT, 0, set_selection_color);
+ if (!bg2_set) getsyscolor(COLOR_WINDOW, fl_bg2,Fl::background2);
+ if (!fg_set) getsyscolor(COLOR_WINDOWTEXT, fl_fg, Fl::foreground);
+ if (!bg_set) getsyscolor(COLOR_BTNFACE, fl_bg, Fl::background);
+ getsyscolor(COLOR_HIGHLIGHT, 0, set_selection_color);
}
@@ -484,10 +482,10 @@ int Fl_WinAPI_Screen_Driver::compose(int &del) {
Fl_RGB_Image * // O - image or NULL if failed
Fl_WinAPI_Screen_Driver::read_win_rectangle(
- int X, // I - Left position
- int Y, // I - Top position
- int w, // I - Width of area to read
- int h, // I - Height of area to read
+ int X, // I - Left position
+ int Y, // I - Top position
+ int w, // I - Width of area to read
+ int h, // I - Height of area to read
Fl_Window *win, // I - window to capture from or NULL to capture from current offscreen
bool may_capture_subwins, bool *did_capture_subwins)
{
@@ -505,26 +503,26 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle(
Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y, int w, int h, Fl_Window *win)
{
- int d = 3; // Depth of image
+ int d = 3; // Depth of image
int alpha = 0; uchar *p = NULL;
- // Allocate the image data array as needed...
+ // Allocate the image data array as needed...
const uchar *oldp = p;
if (!p) p = new uchar[w * h * d];
-
+
// Initialize the default colors/alpha in the whole image...
memset(p, alpha, w * h * d);
-
+
// Grab all of the pixels in the image...
-
+
// Assure that we are not trying to read non-existing data. If it is so, the
// function should still work, but the out-of-bounds part of the image is
// untouched (initialized with the alpha value or 0 (black), resp.).
-
+
int ww = w; // We need the original width for output data line size
-
+
int shift_x = 0; // X target shift if X modified
int shift_y = 0; // Y target shift if X modified
-
+
if (X < 0) {
shift_x = -X;
w += X;
@@ -535,64 +533,64 @@ Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y,
h += Y;
Y = 0;
}
-
- if (h < 1 || w < 1) return 0/*p*/; // nothing to copy
-
- int line_size = ((3*w+3)/4) * 4; // each line is aligned on a DWORD (4 bytes)
- uchar *dib = new uchar[line_size*h]; // create temporary buffer to read DIB
-
+
+ if (h < 1 || w < 1) return 0/*p*/; // nothing to copy
+
+ int line_size = ((3*w+3)/4) * 4; // each line is aligned on a DWORD (4 bytes)
+ uchar *dib = new uchar[line_size*h]; // create temporary buffer to read DIB
+
// fill in bitmap info for GetDIBits
-
+
BITMAPINFO bi;
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biWidth = w;
- bi.bmiHeader.biHeight = -h; // negative => top-down DIB
+ bi.bmiHeader.biHeight = -h; // negative => top-down DIB
bi.bmiHeader.biPlanes = 1;
- bi.bmiHeader.biBitCount = 24; // 24 bits RGB
+ bi.bmiHeader.biBitCount = 24; // 24 bits RGB
bi.bmiHeader.biCompression = BI_RGB;
bi.bmiHeader.biSizeImage = 0;
bi.bmiHeader.biXPelsPerMeter = 0;
bi.bmiHeader.biYPelsPerMeter = 0;
bi.bmiHeader.biClrUsed = 0;
bi.bmiHeader.biClrImportant = 0;
-
+
// copy bitmap from original DC (Window, Fl_Offscreen, ...)
if (win && Fl_Window::current() != win) win->make_current();
HDC gc = (HDC)fl_graphics_driver->gc();
HDC hdc = CreateCompatibleDC(gc);
HBITMAP hbm = CreateCompatibleBitmap(gc,w,h);
-
- int save_dc = SaveDC(hdc); // save context for cleanup
- SelectObject(hdc,hbm); // select bitmap
- BitBlt(hdc,0,0,w,h,gc,X,Y,SRCCOPY); // copy image section to DDB
-
+
+ int save_dc = SaveDC(hdc); // save context for cleanup
+ SelectObject(hdc,hbm); // select bitmap
+ BitBlt(hdc,0,0,w,h,gc,X,Y,SRCCOPY); // copy image section to DDB
+
// copy RGB image data to the allocated DIB
-
+
GetDIBits(hdc, hbm, 0, h, dib, (BITMAPINFO *)&bi, DIB_RGB_COLORS);
-
+
// finally copy the image data to the user buffer
-
+
for (int j = 0; j<h; j++) {
- const uchar *src = dib + j * line_size; // source line
- uchar *tg = p + (j + shift_y) * d * ww + shift_x * d; // target line
+ const uchar *src = dib + j * line_size; // source line
+ uchar *tg = p + (j + shift_y) * d * ww + shift_x * d; // target line
for (int i = 0; i<w; i++) {
uchar b = *src++;
uchar g = *src++;
- *tg++ = *src++; // R
- *tg++ = g; // G
- *tg++ = b; // B
+ *tg++ = *src++; // R
+ *tg++ = g; // G
+ *tg++ = b; // B
if (alpha)
- *tg++ = alpha; // alpha
+ *tg++ = alpha; // alpha
}
}
-
+
// free used GDI and other structures
-
- RestoreDC(hdc,save_dc); // reset DC
+
+ RestoreDC(hdc,save_dc); // reset DC
DeleteDC(hdc);
DeleteObject(hbm);
- delete[] dib; // delete DIB temporary buffer
-
+ delete[] dib; // delete DIB temporary buffer
+
Fl_RGB_Image *rgb = new Fl_RGB_Image(p, w, h, d);
if (!oldp) rgb->alloc_array = 1;
return rgb;
@@ -622,7 +620,3 @@ int Fl_WinAPI_Screen_Driver::screen_num_unscaled(int x, int y)
}
return screen;
}
-
-//
-// End of "$Id$".
-//
diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
index d4b12fc34..e6446923d 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// Windows system driver for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2020 by Bill Spitzak and others.
@@ -11,9 +9,9 @@
//
// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// https://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
/**
@@ -117,7 +115,3 @@ public:
};
#endif // FL_WINAPI_SYSTEM_DRIVER_H
-
-//
-// End of "$Id$".
-//
diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
index 10c6a7b38..ab20cfe32 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// Definition of Windows system driver for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2020 by Bill Spitzak and others.
@@ -11,9 +9,9 @@
//
// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// https://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
#include "../../config_lib.h"
@@ -92,12 +90,12 @@ extern "C" {
Pseudo doxygen docs (static function intentionally not documented):
- param[in] utf8 input string (UTF-8)
- param[in,out] wbuf in: pointer to output string buffer
- out: new string (the pointer may be changed)
- param[in] lg optional: input string length (default = -1)
+ param[in] utf8 input string (UTF-8)
+ param[in,out] wbuf in: pointer to output string buffer
+ out: new string (the pointer may be changed)
+ param[in] lg optional: input string length (default = -1)
- returns pointer to string buffer
+ returns pointer to string buffer
*/
static wchar_t *utf8_to_wchar(const char *utf8, wchar_t *&wbuf, int lg = -1) {
unsigned len = (lg >= 0) ? (unsigned)lg : (unsigned)strlen(utf8);
@@ -129,11 +127,11 @@ static wchar_t *utf8_to_wchar(const char *utf8, wchar_t *&wbuf, int lg = -1) {
Pseudo doxygen docs (static function intentionally not documented):
- param[in] wstr input string (wide character, UTF-16)
- param[in,out] utf8 in: pointer to output string buffer
- out: new string (pointer may be changed)
+ param[in] wstr input string (wide character, UTF-16)
+ param[in,out] utf8 in: pointer to output string buffer
+ out: new string (pointer may be changed)
- returns pointer to string buffer
+ returns pointer to string buffer
*/
static char *wchar_to_utf8(const wchar_t *wstr, char *&utf8) {
unsigned len = (unsigned)wcslen(wstr);
@@ -146,7 +144,7 @@ static char *wchar_to_utf8(const wchar_t *wstr, char *&utf8) {
/*
Creates a driver that manages all system related calls.
-
+
This function must be implemented once for every platform.
*/
Fl_System_Driver *Fl_System_Driver::newSystemDriver()
@@ -239,7 +237,7 @@ int Fl_WinAPI_System_Driver::execvp(const char *file, char *const *argv) {
# else
wchar_t **ar;
utf8_to_wchar(file, wbuf);
-
+
int i = 0, n = 0;
while (argv[i]) {i++; n++;}
ar = (wchar_t **)malloc(sizeof(wchar_t *) * (n + 1));
@@ -254,14 +252,14 @@ int Fl_WinAPI_System_Driver::execvp(const char *file, char *const *argv) {
i++;
}
ar[n] = NULL;
- _wexecvp(wbuf, ar); // STR #3040
+ _wexecvp(wbuf, ar); // STR #3040
i = 0;
while (i < n) {
free(ar[i]);
i++;
}
free(ar);
- return -1; // STR #3040
+ return -1; // STR #3040
#endif
}
@@ -362,7 +360,7 @@ char *fl_locale_to_utf8(const char *s, int len, UINT codepage)
}
if (codepage < 1) codepage = fl_codepage;
buf[l] = 0;
-
+
l = MultiByteToWideChar(codepage, 0, s, len, (WCHAR*)wbufa, buf_len);
if (l < 0) l = 0;
wbufa[l] = 0;
@@ -503,16 +501,16 @@ int Fl_WinAPI_System_Driver::filename_expand(char *to, int tolen, const char *fr
char *start = temp;
char *end = temp+strlen(temp);
int ret = 0;
- for (char *a=temp; a<end; ) { // for each slash component
+ for (char *a=temp; a<end; ) { // for each slash component
char *e; for (e=a; e<end && !isdirsep(*e); e++) {/*empty*/} // find next slash
const char *value = 0; // this will point at substitute value
switch (*a) {
- case '~': // a home directory name
- if (e <= a+1) { // current user's directory
+ case '~': // a home directory name
+ if (e <= a+1) { // current user's directory
value = getenv("HOME");
}
break;
- case '$': /* an environment variable */
+ case '$': /* an environment variable */
{char t = *e; *(char *)e = 0; value = getenv(a+1); *(char *)e = t;}
break;
}
@@ -539,16 +537,16 @@ int Fl_WinAPI_System_Driver::filename_expand(char *to, int tolen, const char *fr
}
int // O - 0 if no change, 1 if changed
-Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename
+Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename
int tolen, // I - Size of "to" buffer
const char *from, // I - Absolute filename
const char *base) // I - Find path relative to this path
{
- char *newslash; // Directory separator
- const char *slash; // Directory separator
+ char *newslash; // Directory separator
+ const char *slash; // Directory separator
char *cwd = 0L, *cwd_buf = 0L;
if (base) cwd = cwd_buf = strdup(base);
-
+
// return if "from" is not an absolute path
if (from[0] == '\0' ||
(!isdirsep(*from) && !isalpha(*from) && from[1] != ':' &&
@@ -557,7 +555,7 @@ Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename
if (cwd_buf) free(cwd_buf);
return 0;
}
-
+
// return if "cwd" is not an absolute path
if (!cwd || cwd[0] == '\0' ||
(!isdirsep(*cwd) && !isalpha(*cwd) && cwd[1] != ':' &&
@@ -566,18 +564,18 @@ Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename
if (cwd_buf) free(cwd_buf);
return 0;
}
-
+
// convert all backslashes into forward slashes
for (newslash = strchr(cwd, '\\'); newslash; newslash = strchr(newslash + 1, '\\'))
*newslash = '/';
-
+
// test for the exact same string and return "." if so
if (!strcasecmp(from, cwd)) {
strlcpy(to, ".", tolen);
free(cwd_buf);
return (1);
}
-
+
// test for the same drive. Return the absolute path if not
if (tolower(*from & 255) != tolower(*cwd & 255)) {
// Not the same drive...
@@ -585,44 +583,44 @@ Fl_WinAPI_System_Driver::filename_relative(char *to, // O - Relative filename
free(cwd_buf);
return 0;
}
-
+
// compare the path name without the drive prefix
from += 2; cwd += 2;
-
+
// compare both path names until we find a difference
for (slash = from, newslash = cwd;
*slash != '\0' && *newslash != '\0';
slash ++, newslash ++)
if (isdirsep(*slash) && isdirsep(*newslash)) continue;
else if (tolower(*slash & 255) != tolower(*newslash & 255)) break;
-
+
// skip over trailing slashes
if ( *newslash == '\0' && *slash != '\0' && !isdirsep(*slash)
&&(newslash==cwd || !isdirsep(newslash[-1])) )
newslash--;
-
+
// now go back to the first character of the first differing paths segment
while (!isdirsep(*slash) && slash > from) slash --;
if (isdirsep(*slash)) slash ++;
-
+
// do the same for the current dir
if (isdirsep(*newslash)) newslash --;
if (*newslash != '\0')
while (!isdirsep(*newslash) && newslash > cwd) newslash --;
-
+
// prepare the destination buffer
to[0] = '\0';
to[tolen - 1] = '\0';
-
+
// now add a "previous dir" sequence for every following slash in the cwd
while (*newslash != '\0') {
if (isdirsep(*newslash)) strlcat(to, "../", tolen);
newslash ++;
}
-
+
// finally add the differing path from "from"
strlcat(to, slash, tolen);
-
+
free(cwd_buf);
return 1;
}
@@ -668,9 +666,9 @@ int Fl_WinAPI_System_Driver::filename_absolute(char *to, int tolen, const char *
int Fl_WinAPI_System_Driver::filename_isdir(const char *n)
{
- struct _stat s;
- char fn[FL_PATH_MAX];
- int length;
+ struct _stat s;
+ char fn[FL_PATH_MAX];
+ int length;
length = (int) strlen(n);
// This workaround brought to you by the fine folks at Microsoft!
// (read lots of sarcasm in that...)
@@ -711,7 +709,7 @@ const char *Fl_WinAPI_System_Driver::filename_ext(const char *buf) {
int Fl_WinAPI_System_Driver::open_uri(const char *uri, char *msg, int msglen)
{
- if (msg) snprintf(msg, msglen, "open %s", uri);
+ if (msg) snprintf(msg, msglen, "open %s", uri);
return (int)(ShellExecute(HWND_DESKTOP, "open", uri, NULL, NULL, SW_SHOW) > (void *)32);
}
@@ -734,7 +732,7 @@ int Fl_WinAPI_System_Driver::file_browser_load_filesystem(Fl_File_Browser *brows
//
// Normal Windows code uses drive bits...
//
- DWORD drives; // Drive available bits
+ DWORD drives; // Drive available bits
drives = GetLogicalDrives();
for (int i = 'A'; i <= 'Z'; i ++, drives >>= 1)
if (drives & 1)
@@ -773,19 +771,19 @@ void Fl_WinAPI_System_Driver::newUUID(char *uuidBuffer)
UUID ud;
UUID *pu = &ud;
int got_uuid = 0;
-
- if (!hMod) { // first time in?
+
+ if (!hMod) { // first time in?
hMod = LoadLibrary("Rpcrt4.dll");
}
-
- if (hMod) { // do we have a usable handle to Rpcrt4.dll?
+
+ if (hMod) { // do we have a usable handle to Rpcrt4.dll?
uuid_func uuid_crt = (uuid_func)GetProcAddress(hMod, "UuidCreate");
if (uuid_crt != NULL) {
RPC_STATUS rpc_res = uuid_crt(pu);
if ( // is the return status OK for our needs?
- (rpc_res == RPC_S_OK) || // all is well
+ (rpc_res == RPC_S_OK) || // all is well
(rpc_res == RPC_S_UUID_LOCAL_ONLY) || // only unique to this machine
- (rpc_res == RPC_S_UUID_NO_ADDRESS) // probably only locally unique
+ (rpc_res == RPC_S_UUID_NO_ADDRESS) // probably only locally unique
) {
got_uuid = -1;
sprintf(uuidBuffer, "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
@@ -795,14 +793,14 @@ void Fl_WinAPI_System_Driver::newUUID(char *uuidBuffer)
}
}
}
- if (got_uuid == 0) { // did not make a UUID - use fallback logic
+ if (got_uuid == 0) { // did not make a UUID - use fallback logic
unsigned char b[16];
- time_t t = time(0); // first 4 byte
+ time_t t = time(0); // first 4 byte
b[0] = (unsigned char)t;
b[1] = (unsigned char)(t>>8);
b[2] = (unsigned char)(t>>16);
b[3] = (unsigned char)(t>>24);
- int r = rand(); // four more bytes
+ int r = rand(); // four more bytes
b[4] = (unsigned char)r;
b[5] = (unsigned char)(r>>8);
b[6] = (unsigned char)(r>>16);
@@ -836,8 +834,8 @@ void Fl_WinAPI_System_Driver::newUUID(char *uuidBuffer)
char *Fl_WinAPI_System_Driver::preference_rootnode(Fl_Preferences *prefs, Fl_Preferences::Root root, const char *vendor,
const char *application)
{
-# define FLPREFS_RESOURCE "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
-# define FLPREFS_RESOURCEW L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
+# define FLPREFS_RESOURCE "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
+# define FLPREFS_RESOURCEW L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
static char *filename = 0L;
// make enough room for a UTF16 pathname
if (!filename) filename = (char*)::malloc(2*FL_PATH_MAX);
@@ -847,7 +845,7 @@ char *Fl_WinAPI_System_Driver::preference_rootnode(Fl_Preferences *prefs, Fl_Pre
DWORD nn;
LONG err;
HKEY key;
-
+
switch (root&Fl_Preferences::ROOT_MASK) {
case Fl_Preferences::SYSTEM:
err = RegOpenKeyW( HKEY_LOCAL_MACHINE, FLPREFS_RESOURCEW, &key );
@@ -953,7 +951,3 @@ void Fl_WinAPI_System_Driver::gettime(time_t *sec, int *usec) {
*sec = t.time;
*usec = t.millitm * 1000;
}
-
-//
-// End of "$Id$".
-//
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
index e9c35d62b..89f83a955 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// Definition of Apple Cocoa window driver
// for the Fast Light Tool Kit (FLTK).
//
@@ -10,11 +8,11 @@
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
-// http://www.fltk.org/COPYING.php
+// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// http://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
/**
@@ -33,13 +31,13 @@
There is one window driver for each Fl_Window. Window drivers manage window
actions such as resizing, events, decoration, fullscreen modes, etc. . All
- drawing and rendering is managed by the Surface device and the associated
+ drawing and rendering is managed by the Surface device and the associated
graphics driver.
- window specific event handling
- window types and styles, depth, etc.
- decorations
-
+
? where do we handle the interface between OpenGL/DirectX and Cocoa/Windows/Glx?
*/
@@ -124,7 +122,3 @@ public:
#endif // FL_WINAPI_WINDOW_DRIVER_H
-
-//
-// End of "$Id$".
-//
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index 09b677fff..aa20c0c7f 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// Definition of Apple Cocoa window driver.
//
// Copyright 1998-2020 by Bill Spitzak and others.
@@ -9,11 +7,11 @@
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
-// http://www.fltk.org/COPYING.php
+// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// http://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
@@ -209,13 +207,13 @@ static HRGN bitmap2region(Fl_Image* image) {
/* Does this need to be dynamically determined, perhaps? */
const int ALLOC_UNIT = 100;
DWORD maxRects = ALLOC_UNIT;
-
+
RGNDATA* pData = (RGNDATA*)malloc(sizeof(RGNDATAHEADER)+(sizeof(RECT)*maxRects));
pData->rdh.dwSize = sizeof(RGNDATAHEADER);
pData->rdh.iType = RDH_RECTANGLES;
pData->rdh.nCount = pData->rdh.nRgnSize = 0;
SetRect(&pData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0);
-
+
const int bytesPerLine = (image->w() + 7)/8;
BYTE* p, *data = (BYTE*)*image->data();
for (int y = 0; y < image->h(); y++) {
@@ -374,7 +372,7 @@ void Fl_WinAPI_Window_Driver::flush_overlay()
void Fl_WinAPI_Window_Driver::icons(const Fl_RGB_Image *icons[], int count) {
free_icons();
-
+
if (count > 0) {
icon_->icons = new Fl_RGB_Image*[count];
icon_->count = count;
@@ -384,7 +382,7 @@ void Fl_WinAPI_Window_Driver::icons(const Fl_RGB_Image *icons[], int count) {
icon_->icons[i]->normalize();
}
}
-
+
if (Fl_X::i(pWindow))
set_icons();
}
@@ -419,7 +417,7 @@ void Fl_WinAPI_Window_Driver::free_icons() {
void Fl_WinAPI_Window_Driver::make_current() {
fl_GetDC(fl_xid(pWindow));
-
+
#if USE_COLORMAP
// Windows maintains a hardware and software color palette; the
// SelectPalette() call updates the current soft->hard mapping
@@ -427,7 +425,7 @@ void Fl_WinAPI_Window_Driver::make_current() {
// code does any drawing...
fl_select_palette();
#endif // USE_COLORMAP
-
+
fl_graphics_driver->clip_region(0);
((Fl_GDI_Graphics_Driver*)fl_graphics_driver)->scale(Fl::screen_driver()->scale(screen_num()));
}
@@ -478,7 +476,7 @@ void Fl_WinAPI_Window_Driver::hide() {
}
if (hide_common()) return;
-
+
// make sure any custom icons get freed
// icons(NULL, 0); // free_icons() is called by the Fl_Window destructor
// this little trick keeps the current clipboard alive, even if we are about
@@ -498,9 +496,9 @@ void Fl_WinAPI_Window_Driver::hide() {
if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0);
# endif
}
-
+
if (ip->region) Fl_Graphics_Driver::default_driver().XDestroyRegion(ip->region);
-
+
// this little trickery seems to avoid the popup window stacking problem
HWND p = GetForegroundWindow();
if (p==GetParent(ip->xid)) {
@@ -541,19 +539,19 @@ void Fl_WinAPI_Window_Driver::make_fullscreen(int X, int Y, int W, int H) {
Fl_Window *w = pWindow;
int top, bottom, left, right;
int sx, sy, sw, sh;
-
+
top = fullscreen_screen_top();
bottom = fullscreen_screen_bottom();
left = fullscreen_screen_left();
right = fullscreen_screen_right();
-
+
if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) {
top = screen_num();
bottom = top;
left = top;
right = top;
}
-
+
Fl::screen_xywh(sx, sy, sw, sh, top);
Y = sy;
Fl::screen_xywh(sx, sy, sw, sh, bottom);
@@ -562,11 +560,11 @@ void Fl_WinAPI_Window_Driver::make_fullscreen(int X, int Y, int W, int H) {
X = sx;
Fl::screen_xywh(sx, sy, sw, sh, right);
W = sx + sw - X;
-
+
DWORD flags = GetWindowLong(fl_xid(w), GWL_STYLE);
flags = flags & ~(WS_THICKFRAME|WS_CAPTION);
SetWindowLong(fl_xid(w), GWL_STYLE, flags);
-
+
// SWP_NOSENDCHANGING is so that we can override size limits
float s = Fl::screen_driver()->scale(screen_num());
SetWindowPos(fl_xid(w), HWND_TOP, X*s, Y*s, W*s, H*s, SWP_NOSENDCHANGING | SWP_FRAMECHANGED);
@@ -709,7 +707,3 @@ void Fl_WinAPI_Window_Driver::resize_after_screen_change(void *data) {
const Fl_Image* Fl_WinAPI_Window_Driver::shape() {
return shape_data_ ? shape_data_->shape_ : NULL;
}
-
-//
-// End of "$Id$".
-//