• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++objective-ccocoa誰得c#linuxgamebathyscaphephp翻訳qtpythonrubycwindowsomegattwitterguiframeworkbtronarduinovb.netdirectxtestゲームエンジンdom計画中(planning stage)previewer

ninix-aya(git://git.osdn.net/gitroot/ninix-aya/ruby-gtk3.git)のfork


コミットメタ情報

リビジョン05b11d14fe8fc3c2849149b7455e21ccef41e052 (tree)
日時2018-07-07 18:07:49
作者Shyouzou Sugitani <shy@user...>
コミッターShyouzou Sugitani

ログメッセージ

misc fixes

変更サマリ

差分

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
11 Sat July 7 2018 Shyouzou Sugitani <shy@users.osdn.me>
22 * できるだけ広範囲のバージョンのRuby/Gtk3で動作するように調整した.
3+ * easyballoon互換モジュールが旧描画方法のままになっていたのを修正した.
4+ * CommunicateWindowが旧描画方法のままになっていたのを修正した.
35
46 Sun April 29 2018 Shyouzou Sugitani <shy@users.osdn.me>
57 * MCIAudio(R)互換モジュールのメッセージ処理を修正した.
--- a/lib/ninix/balloon.rb
+++ b/lib/ninix/balloon.rb
@@ -1505,6 +1505,7 @@ module Balloon
15051505 def new_(desc, balloon)
15061506 @window.destroy unless @window.nil?
15071507 @window = Pix::BaseTransparentWindow.new()
1508+ @__surface_position = [0, 0]
15081509 @window.set_title('communicate')
15091510 @window.signal_connect('delete_event') do |w ,e|
15101511 next delete(w, e)
@@ -1526,10 +1527,14 @@ module Balloon
15261527 @window.drag_dest_add_text_targets()
15271528 @window.set_events(Gdk::EventMask::BUTTON_PRESS_MASK)
15281529 @window.set_modal(true)
1529- @window.set_window_position(Gtk::WindowPosition::CENTER)
1530+ #@window.set_window_position(Gtk::WindowPosition::CENTER)
15301531 @window.realize()
1532+ @window.override_background_color(
1533+ Gtk::StateFlags::NORMAL, Gdk::RGBA.new(0, 0, 0, 0))
15311534 w = desc.get('communicatebox.width', :default => 250).to_i
15321535 h = desc.get('communicatebox.height', :default => -1).to_i
1536+ left, top, scrn_w, scrn_h = @window.workarea
1537+ @__surface_position = [(scrn_w - w) / 2, (scrn_h - h) / 2] # XXX
15331538 @entry = Gtk::Entry.new
15341539 @entry.signal_connect('activate') do |w|
15351540 next activate(w)
@@ -1562,17 +1567,15 @@ module Balloon
15621567 x = desc.get('communicatebox.x', :default => 10).to_i
15631568 y = desc.get('communicatebox.y', :default => 20).to_i
15641569 overlay = Gtk::Overlay.new()
1565- @entry.set_margin_left(x)
1566- @entry.set_margin_top(y)
1570+ @entry.set_margin_left(x + get_draw_offset()[0])
1571+ @entry.set_margin_top(y + get_draw_offset()[1])
15671572 @entry.set_halign(Gtk::Align::START)
15681573 @entry.set_valign(Gtk::Align::START)
15691574 overlay.add_overlay(@entry)
15701575 overlay.add(darea)
15711576 overlay.show()
15721577 @window.add(overlay)
1573- w = surface.width
1574- h = surface.height
1575- darea.set_size_request(w, h)
1578+ darea.set_size_request(*@window.size) # XXX
15761579 else
15771580 box = Gtk::Box.new(orientation=Gtk::Orientation::HORIZONTAL, spacing=10)
15781581 box.set_border_width(10)
@@ -1591,11 +1594,25 @@ module Balloon
15911594 @entry.set_text(data.text)
15921595 end
15931596
1597+ def get_draw_offset
1598+ return @__surface_position
1599+ end
1600+
15941601 def redraw(widget, cr, surface)
1602+ cr.save()
1603+ # clear
1604+ cr.set_operator(Cairo::OPERATOR_SOURCE)
1605+ cr.set_source_rgba(0, 0, 0, 0)
1606+ cr.paint
1607+ # translate the user-space origin
1608+ cr.translate(*get_draw_offset) # XXX
15951609 cr.set_source(surface, 0, 0)
15961610 cr.set_operator(Cairo::OPERATOR_SOURCE)
1597- cr.paint()
1598- w, h = @window.size
1611+ # copy rectangle on the destination
1612+ cr.rectangle(0, 0, surface.width, surface.height)
1613+ cr.fill()
1614+ cr.restore()
1615+ return if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
15991616 region = Pix.surface_to_region(cr.target.map_to_image)
16001617 # XXX: to avoid losing focus in the text input region
16011618 x = @entry.margin_left
@@ -1603,7 +1620,13 @@ module Balloon
16031620 w = @entry.allocated_width
16041621 h = @entry.allocated_height
16051622 region.union!(x, y, w, h)
1606- @window.input_shape_combine_region(region)
1623+ if @window.supports_alpha
1624+ @window.input_shape_combine_region(nil)
1625+ @window.input_shape_combine_region(region)
1626+ else
1627+ @window.shape_combine_region(nil)
1628+ @window.shape_combine_region(region)
1629+ end
16071630 end
16081631
16091632 def destroy
--- a/lib/ninix/dll/bln.rb
+++ b/lib/ninix/dll/bln.rb
@@ -346,7 +346,7 @@ module Bln
346346 @font_desc = Pango::FontDescription.new
347347 @font_desc.set_family('Sans')
348348 if data.include?('font.bold') and data['font.bold'] == 'on'
349- @font_desc.set_weight(Pango::Weight::BOLD)
349+ @font_desc.set_weight(:bold)
350350 end
351351 @layout.set_wrap(:char)
352352 set_layout()
@@ -755,17 +755,15 @@ module Bln
755755 end
756756
757757 def redraw(widget, cr)
758- scale = @scale
759- cr.scale(scale / 100.0, scale / 100.0)
760- cr.set_source(@balloon_surface, 0, 0)
761- cr.set_operator(Cairo::OPERATOR_SOURCE)
762- cr.paint()
758+ @window.set_surface(cr, @balloon_surface, @scale)
763759 cr.set_operator(Cairo::OPERATOR_OVER) # restore default
760+ cr.translate(*@window.get_draw_offset) # XXX
764761 unless @layout.nil?
765762 cr.set_source_rgb(*@fontcolor)
766763 cr.move_to(@left.to_i, @top.to_i)
767764 cr.show_pango_layout(@layout)
768765 end
766+ @window.set_shape(cr)
769767 end
770768
771769 def get_state
--- a/lib/ninix/pix.rb
+++ b/lib/ninix/pix.rb
@@ -49,7 +49,7 @@ module Pix
4949
5050 class BaseTransparentWindow < Gtk::Window
5151 alias :base_move :move
52- attr_reader :workarea
52+ attr_reader :workarea, :supports_alpha
5353
5454 def initialize(type: Gtk::WindowType::TOPLEVEL)
5555 super(type)