From 71e95af813e16ffbd620ebf15a5da4be076eb130 Mon Sep 17 00:00:00 2001 From: "ramiro%netscape.com" Date: Tue, 13 Jul 1999 19:40:15 +0000 Subject: [PATCH] NOT PART OF BUILD. Adding these. git-svn-id: svn://10.0.0.236/trunk@39160 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/xlib/Makefile.in | 1 + mozilla/widget/src/xlib/nsXUtils.cpp | 101 +++++++++++++++++++++++++++ mozilla/widget/src/xlib/nsXUtils.h | 32 +++++++++ 3 files changed, 134 insertions(+) create mode 100644 mozilla/widget/src/xlib/nsXUtils.cpp create mode 100644 mozilla/widget/src/xlib/nsXUtils.h diff --git a/mozilla/widget/src/xlib/Makefile.in b/mozilla/widget/src/xlib/Makefile.in index 23bfd8ecc3f..a10a846d4d5 100644 --- a/mozilla/widget/src/xlib/Makefile.in +++ b/mozilla/widget/src/xlib/Makefile.in @@ -66,6 +66,7 @@ CPPSRCS=\ nsWidget.cpp \ nsWidgetFactory.cpp \ nsWindow.cpp \ + nsXUtils.cpp \ $(NULL) TARGETS = $(LIBRARY) diff --git a/mozilla/widget/src/xlib/nsXUtils.cpp b/mozilla/widget/src/xlib/nsXUtils.cpp new file mode 100644 index 00000000000..84f820c9f30 --- /dev/null +++ b/mozilla/widget/src/xlib/nsXUtils.cpp @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsXUtils.h" + +#include +#include + +////////////////////////////////////////////////////////////////// +/* static */ void +nsXUtils::FlashWindow(Display * display, + Window window, + unsigned int times, /* Number of times to flash */ + unsigned long interval) /* Interval between flashes */ +{ + Window root_window; + Window child_window; + GC gc; + int x; + int y; + unsigned int width; + unsigned int height; + unsigned int border_width; + unsigned int depth; + int root_x; + int root_y; + unsigned int i; + + XGCValues gcv; + + XGetGeometry(display, + window, + &root_window, + &x, + &y, + &width, + &height, + &border_width, + &depth); + + XTranslateCoordinates(display, + window, + root_window, + 0, + 0, + &root_x, + &root_y, + &child_window); + + memset(&gcv, 0, sizeof(XGCValues)); + + gcv.function = GXxor; + gcv.foreground = WhitePixel(display, DefaultScreen(display)); + gcv.subwindow_mode = IncludeInferiors; + + if (gcv.foreground == 0) + gcv.foreground = 1; + + gc = XCreateGC(display, + root_window, + GCFunction | GCForeground | GCSubwindowMode, + &gcv); + + XGrabServer(display); + + for (i = 0; i < times; i++) + { + XFillRectangle(display, + root_window, + gc, + root_x, + root_y, + width, + height); + + XSync(display, False); + + usleep(interval); + } + + + XFreeGC(display, gc); + + XUngrabServer(display); +} +/*****************************************************************/ diff --git a/mozilla/widget/src/xlib/nsXUtils.h b/mozilla/widget/src/xlib/nsXUtils.h new file mode 100644 index 00000000000..13b57a86d34 --- /dev/null +++ b/mozilla/widget/src/xlib/nsXUtils.h @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef __nsXUtils_h +#define __nsXUtils_h + +#include + +struct nsXUtils +{ + static void FlashWindow(Display * display, + Window window, + unsigned int times, /* Number of times to flash */ + unsigned long interval); /* Interval between flashes */ +}; + +#endif // __nsXUtils_h