Fix dpi handling in sandbox

This commit is contained in:
Dan Walsh 2011-11-29 15:25:50 -05:00
parent e0ffc386e8
commit c165d4c12a
2 changed files with 28 additions and 20 deletions

View File

@ -111,7 +111,7 @@ index 1c458f1..96c6795 100644
install -m 4755 seunshare $(SBINDIR)/
-mkdir -p $(SHAREDIR)
diff --git a/policycoreutils/sandbox/sandbox b/policycoreutils/sandbox/sandbox
index 486cd4e..a21e508 100644
index 486cd4e..6987652 100644
--- a/policycoreutils/sandbox/sandbox
+++ b/policycoreutils/sandbox/sandbox
@@ -118,10 +118,30 @@ def reserve(level):
@ -160,35 +160,27 @@ index 486cd4e..a21e508 100644
def fullpath(cmd):
for i in [ "/", "./", "../" ]:
@@ -160,6 +183,17 @@ class Sandbox:
@@ -160,7 +183,7 @@ class Sandbox:
self.__level = None
self.__homedir = None
self.__tmpdir = None
+ self.__set_dpi()
-
+
+ def __set_dpi(self):
+ rc, out = commands.getstatusoutput("/usr/bin/xrdb -query")
+ if rc != 0:
+ self.dpi = 96
+ else:
+ for i in out.split("\n"):
+ if i.startswith("Xft.dpi:"):
+ self.dpi = i.split()[1]
+ break;
def __validate_mount(self):
if self.__options.level:
@@ -278,6 +312,9 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
if not self.__options.homedir or not self.__options.tmpdir:
@@ -278,6 +301,10 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
action="callback", callback=self.__mount_callback,
help=_("mount new home and/or tmp directory"))
+ parser.add_option("-d", "--dpi",
+ dest="dpi", action="store",default=self.dpi,
+ help=_("dots per inch for X display: (%s)" % self.dpi))
+ dest="dpi", action="store",
+ help=_("dots per inch for X display"))
+
parser.add_option("-S", "--session", action="store_true", dest="session",
default=False, help=_("run complete desktop session within sandbox"))
@@ -322,7 +359,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
@@ -322,7 +349,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
if self.__options.X_ind:
self.setype = DEFAULT_X_TYPE
@ -197,12 +189,25 @@ index 486cd4e..a21e508 100644
if self.__options.setype:
self.setype = self.__options.setype
@@ -408,7 +445,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
@@ -401,6 +428,12 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
cmds += [ "-t", self.__tmpdir, "-h", self.__homedir ]
if self.__options.X_ind:
+ if self.__options.dpi:
+ dpi = self.__options.dpi:
+ else:
+ import gtk
+ dpi = gtk.settings_get_default().props.gtk_xft_dpi/1024
+
xmodmapfile = self.__homedir + "/.xmodmap"
xd = open(xmodmapfile,"w")
subprocess.Popen(["/usr/bin/xmodmap","-pke"],stdout=xd).wait()
@@ -408,7 +441,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
self.__setup_sandboxrc(self.__options.wm)
- cmds += [ "--", SANDBOXSH, self.__options.windowsize, self.dpi ]
+ cmds += [ "--", SANDBOXSH, self.__options.windowsize, self.__options.dpi ]
+ cmds += [ "--", SANDBOXSH, self.__options.windowsize, dpi ]
else:
cmds += [ "--" ] + self.__paths
return subprocess.Popen(cmds).wait()

View File

@ -7,7 +7,7 @@
Summary: SELinux policy core utilities
Name: policycoreutils
Version: 2.1.8
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv2
Group: System Environment/Base
# Based on git repository with tag 20101221
@ -352,6 +352,9 @@ fi
/bin/systemctl try-restart restorecond.service >/dev/null 2>&1 || :
%changelog
* Tue Nov 29 2011 Dan Walsh <dwalsh@redhat.com> - 2.1.8-7
- Fix dpi handling in sandbox
* Wed Nov 16 2011 Dan Walsh <dwalsh@redhat.com> - 2.1.8-6
- Add listing of distribution equivalence class from semanage fcontext -l
- Add checking to semanage fcontext -a to guarantee a file specification will not be masked by an equivalence