aboutsummaryrefslogtreecommitdiff
path: root/src/outline.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/outline.c')
-rw-r--r--src/outline.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/outline.c b/src/outline.c
new file mode 100644
index 0000000..b42e70a
--- /dev/null
+++ b/src/outline.c
@@ -0,0 +1,73 @@
+/****************************************************************************
+ * Outlines for moving and resizing.
+ * Copyright (C) 2004 Joe Wingbermuehle
+ ****************************************************************************/
+
+#include "jwm.h"
+#include "outline.h"
+#include "main.h"
+
+static GC outlineGC;
+
+static int lastX, lastY;
+static int lastWidth, lastHeight;
+static int outlineDrawn;
+
+/****************************************************************************
+ ****************************************************************************/
+void InitializeOutline() {
+}
+
+/****************************************************************************
+ ****************************************************************************/
+void StartupOutline() {
+
+ XGCValues gcValues;
+
+ gcValues.function = GXinvert;
+ gcValues.subwindow_mode = IncludeInferiors;
+ gcValues.line_width = 2;
+ outlineGC = JXCreateGC(display, rootWindow,
+ GCFunction | GCSubwindowMode | GCLineWidth, &gcValues);
+ outlineDrawn = 0;
+
+}
+
+/****************************************************************************
+ ****************************************************************************/
+void ShutdownOutline() {
+ JXFreeGC(display, outlineGC);
+}
+
+/****************************************************************************
+ ****************************************************************************/
+void DestroyOutline() {
+}
+
+/****************************************************************************
+ ****************************************************************************/
+void DrawOutline(int x, int y, int width, int height) {
+ if(!outlineDrawn) {
+ JXSync(display, False);
+ JXGrabServer(display);
+ JXDrawRectangle(display, rootWindow, outlineGC, x, y, width, height);
+ lastX = x;
+ lastY = y;
+ lastWidth = width;
+ lastHeight = height;
+ outlineDrawn = 1;
+ }
+}
+
+/****************************************************************************
+ ****************************************************************************/
+void ClearOutline() {
+ if(outlineDrawn) {
+ JXDrawRectangle(display, rootWindow, outlineGC,
+ lastX, lastY, lastWidth, lastHeight);
+ outlineDrawn = 0;
+ JXUngrabServer(display);
+ JXSync(display, False);
+ }
+}
+