|
Lines 318-323
Link Here
|
| 318 |
String [] keys; |
318 |
String [] keys; |
| 319 |
Object [] values; |
319 |
Object [] values; |
| 320 |
|
320 |
|
|
|
321 |
/* Work area */ |
| 322 |
Rectangle workArea; |
| 323 |
long workAreaLastUpdated = 0; |
| 324 |
|
| 321 |
/* Initial Guesses for Shell Trimmings. */ |
325 |
/* Initial Guesses for Shell Trimmings. */ |
| 322 |
int borderTrimWidth = 4, borderTrimHeight = 4; |
326 |
int borderTrimWidth = 4, borderTrimHeight = 4; |
| 323 |
int resizeTrimWidth = 6, resizeTrimHeight = 6; |
327 |
int resizeTrimWidth = 6, resizeTrimHeight = 6; |
|
Lines 773-778
Link Here
|
| 773 |
} |
777 |
} |
| 774 |
|
778 |
|
| 775 |
/** |
779 |
/** |
|
|
780 |
* Returns the work area, an EWMH property to store the size |
| 781 |
* and position of the screen not covered by dock and panel |
| 782 |
* windows. |
| 783 |
* |
| 784 |
* http://freedesktop.org/Standards/wm-spec/ |
| 785 |
*/ |
| 786 |
static Rectangle getWorkArea() { |
| 787 |
/* TODO: We will need more atoms like this for other EWMH features. |
| 788 |
* We should list them all and do one large XInternAtoms() call on |
| 789 |
* startup to avoid extra round trips like this one. */ |
| 790 |
byte[] name = Converter.wcsToMbcs(null, "_NET_WORKAREA", true); |
| 791 |
int /*long*/ atom = OS.gdk_atom_intern(name, true); |
| 792 |
if (atom == OS.GDK_NONE) return null; |
| 793 |
int /*long*/[] actualType = new int /*long*/[1]; |
| 794 |
int[] actualFormat = new int[1]; |
| 795 |
int[] actualLength = new int[1]; |
| 796 |
int /*long*/[] data = new int /*long*/[1]; |
| 797 |
int values[] = new int[4]; |
| 798 |
if (!OS.gdk_property_get(OS.GDK_ROOT_PARENT(), atom, OS.GDK_NONE, |
| 799 |
0, 16, 0, actualType, actualFormat, actualLength, data)) return null; |
| 800 |
|
| 801 |
if (data[0] == 0) return null; |
| 802 |
if (actualLength[0] < 16) { |
| 803 |
OS.g_free(data[0]); |
| 804 |
return null; |
| 805 |
} |
| 806 |
|
| 807 |
OS.memmove (values, data[0], 16); |
| 808 |
OS.g_free(data[0]); |
| 809 |
return new Rectangle(values[0],values[1],values[2],values[3]); |
| 810 |
} |
| 811 |
|
| 812 |
/** |
| 776 |
* Returns a rectangle describing the receiver's size and location. |
813 |
* Returns a rectangle describing the receiver's size and location. |
| 777 |
* |
814 |
* |
| 778 |
* @return the bounding rectangle |
815 |
* @return the bounding rectangle |
|
Lines 784-789
Link Here
|
| 784 |
*/ |
821 |
*/ |
| 785 |
public Rectangle getBounds () { |
822 |
public Rectangle getBounds () { |
| 786 |
checkDevice (); |
823 |
checkDevice (); |
|
|
824 |
|
| 825 |
/* Querying the work area is a round trip to the X server. It's also |
| 826 |
* something that updates at runtime. Cache the value, but remember |
| 827 |
* to update often. Every 8 seconds seems reasonable. |
| 828 |
*/ |
| 829 |
long curtime = System.currentTimeMillis(); |
| 830 |
if (workAreaLastUpdated == 0 || curtime > workAreaLastUpdated + 8000) { |
| 831 |
workAreaLastUpdated = curtime; |
| 832 |
workArea = getWorkArea(); |
| 833 |
} |
| 834 |
|
| 835 |
if (workArea != null) { |
| 836 |
return new Rectangle(workArea.x,workArea.y,workArea.width,workArea.height); |
| 837 |
} |
| 787 |
return new Rectangle (0, 0, OS.gdk_screen_width (), OS.gdk_screen_height ()); |
838 |
return new Rectangle (0, 0, OS.gdk_screen_width (), OS.gdk_screen_height ()); |
| 788 |
} |
839 |
} |
| 789 |
|
840 |
|