Java Mailing List Archive

http://www.redhatconfig.com/

Home » Mandriva Cooker »

Re: [Cooker] drakx-kbd-mouse-x11 patch proposal

pcpa

2008-06-03

Replies: Find Java Web Hosting

Author LoginPost Reply
Paulo Cesar Pereira de Andrade wrote:
> Here is a proposed patch to correct the following XFdrake
> problems:
>
> o Inverted logic about the Composite extension. It is enabled
> by default in X Server 1.4 or newer.
> o Incorrect, and unnecessary symlink being generated from
> /usr/bin/Xorg to /etc/X11/X.
> o Doesn't work if /etc/X11/xorg.conf is a symlink to a file
> elsewhere.


Err, forgot to attach a small detail.

Paulo

Index: Makefile.config
===================================================================
--- Makefile.config  (revisão 242849)
+++ Makefile.config  (cópia de trabalho)
@@(protected) @@
NAME = drakx-kbd-mouse-x11
-VERSION = 0.57
+VERSION = 0.58
BRANCH = trunk
Index: lib/Xconfig/main.pm
===================================================================
--- lib/Xconfig/main.pm  (revisão 242849)
+++ lib/Xconfig/main.pm  (cópia de trabalho)
@@(protected) @@
  my $only_resolution = $raw_X->is_only_resolution_modified;
  $raw_X->write;
  Xconfig::various::check_XF86Config_symlink();
-   symlinkf "../../usr/bin/Xorg", "$::prefix/etc/X11/X";
  if ($X->{resolutions}[0]{bios}) {
 Xconfig::various::setupFB($X->{resolutions}[0]{bios});
 'need_reboot';
Index: lib/Xconfig/various.pm
===================================================================
--- lib/Xconfig/various.pm  (revisão 242849)
+++ lib/Xconfig/various.pm  (cópia de trabalho)
@@(protected) @@
  });
}

+sub get_array_hash {
+   my ($array, $name) = @_;
+
+   foreach (@(protected)) {
+  return $_->{$name} if (defined($_->{$name}));
+   }
+   return undef;
+}
+
+sub set_array_hash {
+   my ($array, $name, $value) = @_;
+
+   foreach (@(protected)) {
+  return $_->{$name} = $value if ($_->{$name});
+   }
+   push(@(protected) });
+}
+
+sub composite {
+   my ($raw_X, $enable) = @_;
+
+   my $extensions = $raw_X->get_Section('Extensions') ||
+       $raw_X->add_Section('Extensions', {});
+   my $composite = get_array_hash(\@(protected)');
+
+   if (defined($enable)) {
+  $composite = $enable;
+   }
+   elsif (! defined($composite)) {
+  $composite = 'Enable';
+   }
+
+   set_array_hash(\@(protected));
+   set_array_hash(\@(protected));
+
+   return ($composite ne 'Disable');
+}
+
sub various {
  my ($in, $raw_X, $card, $options, $b_auto, $b_read_existing) = @_;

@@(protected) @@
  my $various = {
 if_($::isStandalone, xdm => runlevel() == 5),
 if_($b_read_existing,
-     Composite => ($raw_X->get_Section('Extensions') || {})->{Composite},
+     Composite => composite($raw_X, undef),
     if_($card->{Options}{MonitorLayout} eq 'NONE,CRT+LFP' ||
    $card->{Options}{TwinViewOrientation} eq 'Clone',
    Clone => 1),
@@(protected) @@
  my ($raw_X, $card, $various) = @_;

  if ($various->{Composite}) {
-  my $raw = $raw_X->get_Section('Extensions') || $raw_X->add_Section('Extensions', {});
-  $raw->{Composite} = { 'Option' => 1 };
+  composite($raw_X, 'Enable');
 if ($card->{Driver} eq 'nvidia') {
    $card->{Options}{AddARGBGLXVisuals} = undef;
 }
  } else {
-  if (my $raw = $raw_X->get_Section('Extensions')) {
-     delete $raw->{Composite};
-     %$raw or $raw_X->remove_Section('Extensions');
-  }
+  composite($raw_X, 'Disable');
 if ($card->{Driver} eq 'nvidia') {
    delete $card->{Options}{AddARGBGLXVisuals};
 }
Index: lib/Xconfig/xfree.pm
===================================================================
--- lib/Xconfig/xfree.pm  (revisão 242849)
+++ lib/Xconfig/xfree.pm  (cópia de trabalho)
@@(protected) @@

my ($Revision) = '$Revision$' =~ /(\d+)/;

+use Cwd;
use diagnostics;
use strict;

use common;
use Xconfig::parse;

+my $conf_file = "$::prefix/etc/X11/xorg.conf";
+
#- mostly internal only
sub new {
  my ($class, $raw) = @_;
  @$raw && bless { raw => $raw }, $class;
}

-sub _conf_files() {
-   map { "$::prefix/etc/X11/$_" } 'xorg.conf', 'XF86Config-4', 'XF86Config';
-}
-
################################################################################
# I/O ##########################################################################
################################################################################
sub read {
  my ($class) = @_;
-   my $file = find { -f $_ } _conf_files();
+   my $file = $conf_file;
  my $raw_X = $class->new(Xconfig::parse::read_XF86Config($file)) or return;
  $raw_X->{before} = $raw_X->prepare_write;

@@(protected) @@
}
sub write {
  my ($raw_X, $o_file) = @_;
-   my $file = $o_file || first(_conf_files());
-   if (!$o_file) {
-  foreach (_conf_files()) {
-     if (-l $_) {
-    unlink $_;
-     } else {
-    renamef($_, "$_.old"); #- there will not be any XF86Config nor XF86Config-4 anymore, we want this!
-     }
-  }
-  #- keep it for old programs still using this name
-  symlink basename($file), "$::prefix/etc/X11/XF86Config";
+   my $file = $o_file || $conf_file;
+   if (!$o_file && -f $file) {
+  $o_file = Cwd::realpath($file);
+  renamef($o_file, "$o_file.old");
  }
  no_ModeLine_on_fglrx($raw_X); #- HACK
  set_Revision($raw_X);
@@(protected) @@

sub add_Section {
  my ($raw_X, $Section, $h) = @_;
-   my @suggested_ordering = qw(Files ServerFlags Module DRI Keyboard Pointer XInput InputDevice Monitor Device Screen ServerLayout);
+   my @suggested_ordering = qw(Extensions Files ServerFlags Module DRI Keyboard Pointer XInput InputDevice Monitor Device Screen ServerLayout);
  my %order = map_index { { lc($_) => $::i } } @suggested_ordering;
  my $e = { name => $Section, l => $h };
  my $added;
Index: lib/Xconfig/parse.pm
===================================================================
--- lib/Xconfig/parse.pm  (revisão 242849)
+++ lib/Xconfig/parse.pm  (cópia de trabalho)
@@(protected) @@
  WacomEraser => [ qw(Port) ], #-/
  ServerLayout => [ qw(Identifier) ],
);
-my @want_string = qw(Identifier DeviceName VendorName ModelName BoardName Driver Device Chipset Monitor Protocol XkbModel XkbLayout XkbOptions XkbCompat Load ModulePath BusID);
+my @want_string = qw(Composite Identifier DeviceName VendorName ModelName BoardName Driver Device Chipset Monitor Protocol XkbModel XkbLayout XkbOptions XkbCompat Load ModulePath BusID);

%kind_names = map_each { lc $::a => [ map { lc } @$::b ] } %kind_names;
@want_string = map { lc } @want_string;
©2008 redhatconfig.com - Jax Systems, LLC, U.S.A.