ampv 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4cd792f9c7d994f5be1035bcbced7c95df683908
4
- data.tar.gz: a16d8998f82dfd65d0611ee602447adbc6fb6c95
3
+ metadata.gz: 943c6cc8f359174b3bf8d5c51c38761dacf1523b
4
+ data.tar.gz: 8a2c814830826c6c8f3c698bd1f8ec0ab7a1cde5
5
5
  SHA512:
6
- metadata.gz: d5c646276dece49053e5ee73dceb67c2de4ce4485ba014c261701798ea9234ce66b68e23f970703e5d2c79ee5c9f7b14c2f3592be418611badfdb8239622747d
7
- data.tar.gz: 8d0e88a8409d93bf33271abf62ca452af5e6296e47d5310007dad00e069e731a04c6284c1bf7772bf91acf7f19848c4bfa0f53599a13ea4d09dfaea8dd8b6170
6
+ metadata.gz: 081a7c98b93fad0f3604c8f1de457b9966477562941db6093954a1dffd5749fa9e3dd4eb7ea8bafa17e32a42b95c8d86e3c50061e2ce0fd383cc94f816b8c928
7
+ data.tar.gz: 3bed50ec7e8b7b2150321d2a7970c6eca6069de872869cc854c1b052658e31e77d7f2036ff066d348ec11cee5cb36f21f4a12b4edec14c154455e504ed62be5b
@@ -163,12 +163,10 @@ module Ampv
163
163
  end
164
164
 
165
165
  def handle_mouse_event(e)
166
- if e.event_type != Gdk::Event::MOTION_NOTIFY
167
- button = e.event_type == Gdk::Event::SCROLL ? WHEEL_BUTTONS[e.direction] : e.button
168
- return if Config["mouse_bindings"][e.event_type].nil?
169
- process_cmd(Config["mouse_bindings"][e.event_type][button])
170
- end
171
- mouse_cursor_timeout
166
+ button = e.event_type == Gdk::Event::SCROLL ? WHEEL_BUTTONS[e.direction] : e.button
167
+ return if Config["mouse_bindings"][e.event_type].nil?
168
+ process_cmd(Config["mouse_bindings"][e.event_type][button])
169
+ mouse_cursor_timeout(true)
172
170
  end
173
171
 
174
172
  def handle_keyboard_event(e)
@@ -182,11 +180,14 @@ module Ampv
182
180
  end
183
181
  end
184
182
 
185
- def mouse_cursor_timeout
186
- window.set_cursor(nil)
183
+ def mouse_cursor_timeout(mevent = false)
187
184
  GLib::Source.remove(@cursor_timeout) if @cursor_timeout
185
+ window.set_cursor(nil)
188
186
  @cursor_timeout = GLib::Timeout.add(1000) {
189
187
  window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::BLANK_CURSOR)) unless @mpv.is_paused
188
+ # hacky workaround when called after a mouse event
189
+ # without this the cursor is still shown when it should not be.
190
+ Gdk::Display.default.warp_pointer(*Gdk::Display.default.pointer[0..2]) if mevent
190
191
  false
191
192
  }
192
193
  end
@@ -1,10 +1,10 @@
1
1
  module Ampv
2
2
  class Config
3
3
 
4
- @@config_file = "#{(ENV["XDG_CONFIG_HOME"] || "#{Dir.home}/.config")}/ampv.conf"
5
- @@input_config = File.exists?("#{Dir.home}/.mpv/input.conf") ?
4
+ CONFIG_FILE = "#{(ENV["XDG_CONFIG_HOME"] || "#{Dir.home}/.config")}/ampv.conf"
5
+ INPUT_CONFIG = File.exists?("#{Dir.home}/.mpv/input.conf") ?
6
6
  "#{Dir.home}/.mpv/input.conf" : File.expand_path("../../../input.conf", __FILE__)
7
- @@key_names = {
7
+ KEY_NAMES = {
8
8
  "esc" => "Escape",
9
9
  "space" => "space",
10
10
  "right" => "Right",
@@ -18,8 +18,7 @@ module Ampv
18
18
  "ins" => "Insert",
19
19
  "del" => "Delete",
20
20
  }
21
- @@config = { }
22
- @@defaults = {
21
+ DEFAULTS = {
23
22
  "width" => Gdk::Screen.default.width > 1280 ? 1280 : 853,
24
23
  "height" => Gdk::Screen.default.width > 1280 ? 726 : 486,
25
24
  "x" => -1,
@@ -42,20 +41,21 @@ module Ampv
42
41
  "key_bindings" => [ ],
43
42
  "mouse_bindings" => [ ]
44
43
  }
44
+ @@config = { }
45
45
 
46
46
  def self.load
47
- if File.exists?(@@config_file)
48
- File.readlines(@@config_file).each { |line|
47
+ if File.exists?(CONFIG_FILE)
48
+ File.readlines(CONFIG_FILE).each { |line|
49
49
  key, _, val = line.partition("=")
50
50
  key.strip!
51
51
  val.strip!
52
- next unless @@defaults.has_key?(key) and key[0] != "#"
52
+ next unless DEFAULTS.has_key?(key) and key[0] != "#"
53
53
 
54
- if @@defaults[key].is_a?(Integer)
54
+ if DEFAULTS[key].is_a?(Integer)
55
55
  val = val.to_i
56
- elsif @@defaults[key].is_a?(TrueClass) or @@defaults[key].is_a?(FalseClass)
56
+ elsif DEFAULTS[key].is_a?(TrueClass) or DEFAULTS[key].is_a?(FalseClass)
57
57
  val = val == "true"
58
- elsif @@defaults[key].is_a?(Gdk::Color)
58
+ elsif DEFAULTS[key].is_a?(Gdk::Color)
59
59
  begin
60
60
  val = Gdk::Color.parse(val)
61
61
  rescue
@@ -78,8 +78,8 @@ module Ampv
78
78
  # load input config
79
79
  self["mouse_bindings"] = [ ]
80
80
  self["key_bindings"] = [ ]
81
- if File.exists?(@@input_config)
82
- File.readlines(@@input_config).each { |line|
81
+ if File.exists?(INPUT_CONFIG)
82
+ File.readlines(INPUT_CONFIG).each { |line|
83
83
  line.strip!
84
84
  if line.start_with?("MOUSE_BTN")
85
85
  # 4 = up, 5 = down, 6 = left, 7 = right
@@ -91,7 +91,7 @@ module Ampv
91
91
  self["mouse_bindings"][type][button] = cmd
92
92
  elsif !line.empty?
93
93
  key, cmd = line.match(/^([^\s]+)\s+(.+)$/).captures
94
- if name = @@key_names[key.downcase]
94
+ if name = KEY_NAMES[key.downcase]
95
95
  keyval = Gdk::Keyval.from_name(name)
96
96
  else
97
97
  keyval = Gdk::Keyval.from_name(key)
@@ -104,7 +104,7 @@ module Ampv
104
104
  end
105
105
 
106
106
  def self.[](key)
107
- @@config[key].nil? ? @@defaults[key] : @@config[key]
107
+ @@config[key].nil? ? DEFAULTS[key] : @@config[key]
108
108
  end
109
109
 
110
110
  def self.[]=(key, value)
@@ -112,7 +112,7 @@ module Ampv
112
112
  end
113
113
 
114
114
  def self.save
115
- File.open(@@config_file, "w") { |file|
115
+ File.open(CONFIG_FILE, "w") { |file|
116
116
  @@config.each { |k, v| file.puts("#{k}=#{v}") unless k == "key_bindings" or k == "mouse_bindings" }
117
117
  }
118
118
  end
@@ -42,7 +42,7 @@ module Ampv
42
42
  vbox.border_width = 10
43
43
  sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
44
44
 
45
- @treeview.set_enable_search (false)
45
+ @treeview.set_enable_search(false)
46
46
  @treeview.set_rubber_banding(true)
47
47
  @treeview.set_reorderable(true)
48
48
  @treeview.set_tooltip_column(0)
@@ -1,5 +1,5 @@
1
1
  module Ampv
2
2
  PACKAGE = "ampv"
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ampv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ahoka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-08 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk2
@@ -61,11 +61,11 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - LICENSE
63
63
  - input.conf
64
- - lib/ampv/mpvwidget.rb
64
+ - lib/ampv/playlist.rb
65
65
  - lib/ampv/progressbarwidget.rb
66
66
  - lib/ampv/config.rb
67
- - lib/ampv/playlist.rb
68
67
  - lib/ampv/version.rb
68
+ - lib/ampv/mpvwidget.rb
69
69
  - lib/ampv.rb
70
70
  - bin/ampv
71
71
  homepage: https://github.com/ahodesuka/ampv